2017-02-22 451 views
2

我有一个Spring Boot应用程序,我正在更新到1.5.1。它的伟大工程,直到我加入警犬和基普金类路径添加侦探和zipkin时,应用程序无法启动

<dependency> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-starter-sleuth</artifactId> 
    </dependency> 
<dependency> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-sleuth-zipkin</artifactId> 
</dependency> 

当这些线路都存在,我得到

2017-02-22 22:33:05.331 ERROR [chathub-api,,,] 7581 --- [   main] o.s.boot.SpringApplication    : Application startup failed 

java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean 

这是我的DEP。管理

<dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>org.springframework.cloud</groupId> 
       <artifactId>spring-cloud-dependencies</artifactId> 
       <version>Camden.SR4</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

我试图改变达尔斯顿

<dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>org.springframework.cloud</groupId> 
       <artifactId>spring-cloud-dependencies</artifactId> 
       <version>Dalston.BUILD-SNAPSHOT</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

    <repositories> 
     <repository> 
      <id>spring-snapshots</id> 
      <name>Spring Snapshots</name> 
      <url>https://repo.spring.io/libs-snapshot</url> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 

但错误得到更奇怪

*************************** 
APPLICATION FAILED TO START 
*************************** 

Description: 

Parameter 0 of method envInfoContributor in org.springframework.boot.actuate.autoconfigure.InfoContributorAutoConfiguration required a bean of type 'org.springframework.core.env.ConfigurableEnvironment' that could not be found. 

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'traceWebFilter' defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceWebFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'traceFilter' defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sleuthTracer' defined in class path resource [org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sleuthTracer' parameter 4; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zipkinSpanListener' defined in class path resource [org/springframework/cloud/sleuth/zipkin/ZipkinAutoConfiguration.class]: Unsatisfied dependency expressed through method 'zipkinSpanListener' parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.core.env.Environment' available: expected at least 1 bean which qualifies as autowire candidate. Dependenc... 

我失去的东西我没有注意到然而?

回答

3

我无法解释您使用Dalston.BUILD-SNAPSHOT获得的错误,但Camden.SR4的错误是因为它与Spring Boot 1.5不兼容。我建议升级到Camden.SR5 which is compatible with Spring Boot 1.5

+0

对不起,同样的错误呢:'没有符合'org.springframework.core.env.Environment'类型的bean。有趣的是,在快速入门部分的http://projects.spring.io/spring-cloud/上,如果我选择Camdem.SR5,它会将SB版本更改为1.4.4.RELEASE,这可能会导致一些混淆。该网站是否过期? –

1

即使在设置我的项目时出现此错误。我在Brixton.SR6发行版中使用了Spring Boot 1.5.8。然而,当我咨询了网站http://projects.spring.io/spring-cloud/后,我开始了解这个问题,并将我的依赖更新到Dalston.SR4,然后应用程序开始工作。