2017-03-07 261 views
3

我想知道Springboot和Springcloud之間是否存在兼容性矩陣?是否有Spring-Boot和Spring-Cloud的兼容性矩陣?

我在STS上創建了一個簡單的項目,並且遇到了兼容性問題。

<parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.5.1.RELEASE</version> 
     <relativePath /> <!-- lookup parent from repository --> 
    </parent> 


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

對Springboot和Springcloud的支持版本有一個很好的看法會使事情變得更簡單。

我沒有看到,談論這需要一個開放的問題 - https://github.com/spring-cloud/spring-cloud-build/issues/43

難道社會人士對他們如何選擇一種方法來獲取特定版本的組合,當他們踏上SpringCloud項目啓動?

編輯:添加,我因爲從昨天的pom.xml

片段遇到這樣的問題的另一個實例

<parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.5.2.RELEASE</version> 
     <!--<version>1.5.2.RELEASE</version> --> 
     <relativePath /> <!-- lookup parent from repository --> 
    </parent> 


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

有使用1.5.2.RELEASE與Camden.SR5沒有Maven的錯誤然而,當應用程序啓動時,會引發NoClassDefFoundError。

2017-03-28 09:51:15.148 ERROR 15808 --- [   main] o.s.boot.SpringApplication    : Application startup failed 

java.lang.NoClassDefFoundError: org/springframework/cloud/context/named/NamedContextFactory$Specification 
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_112] 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_112] 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_112] 
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_112] 
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_112] 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_112] 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_112] 
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_112] 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_112] 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_112] 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_112] 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_112] 
    at org.springframework.cloud.netflix.feign.FeignClientsRegistrar.registerClientConfiguration(FeignClientsRegistrar.java:367) ~[spring-cloud-netflix-core-1.2.5.RELEASE.jar:1.2.5.RELEASE] 
    at org.springframework.cloud.netflix.feign.FeignClientsRegistrar.registerDefaultConfiguration(FeignClientsRegistrar.java:104) ~[spring-cloud-netflix-core-1.2.5.RELEASE.jar:1.2.5.RELEASE] 
    at org.springframework.cloud.netflix.feign.FeignClientsRegistrar.registerBeanDefinitions(FeignClientsRegistrar.java:87) ~[spring-cloud-netflix-core-1.2.5.RELEASE.jar:1.2.5.RELEASE] 
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:352) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:143) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at com.forecastessentials.school.SchoolUniformForecastApplication.main(SchoolUniformForecastApplication.java:12) [classes/:na] 
Caused by: java.lang.ClassNotFoundException: org.springframework.cloud.context.named.NamedContextFactory$Specification 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_112] 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_112] 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_112] 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_112] 
    ... 31 common frames omitted 

使用1.4.5與Brixton.SR6是一種適用於我的組合。

回答

4

如果您按照http://projects.spring.io/spring-cloud/的快速入門,它會告訴您兼容的版本。卡姆登版本序列不具有彈簧引導1.5.x的兼容

你也可以閱讀每個指出兼容的組件版本版本的發行說明:

https://github.com/spring-projects/spring-cloud/wiki/Spring-Cloud-Camden-Release-Notes

春雲卡姆登建立在Spring引導1.4.x.

+0

謝謝。您曾經聲明「Camden發行版本與Spring Boot 1.5.x不兼容」。您引用的Camden發行說明鏈接指出以下內容 - 添加Boot 1.5兼容性並打破Boot 1.3兼容性。快速啓動也說明了相同的信息 - Camden發行版建立在Spring Boot 1.4.x上,但也在1.5.x版本中進行了測試。 – Manglu

+2

從'Camden.SR5'開始,'Camden'發行版將與Boot 1.5兼容。 –

+0

是的,我錯過了。 – Strelok