是否存在Spring-boot和Spring-cloud的兼容性矩阵?

时间:2017-03-07 22:56:06

标签: spring spring-boot version compatibility spring-cloud

我想知道Springboot和Springcloud之间是否存在兼容性矩阵?

我在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>

使用带有Camden.SR5的1.5.2.RELEASE时没有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

在Brixton.SR6中使用1.4.5是一种通常适用于我的组合。

4 个答案:

答案 0 :(得分:13)

如果您按照http://projects.spring.io/spring-cloud/上的快速入门,它会告诉您兼容的版本。 Camden版本系列与Spring Boot 1.5.x不兼容

您还可以阅读每个版本的发行说明,其中包含兼容的组件版本:

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

  

Spring Cloud Camden构建于Spring Boot 1.4.x之上。

答案 1 :(得分:7)

是的,有:http://start.spring.io/actuator/info

除了弹簧云之外,它还包含更多的库,但其中每个库都不是一个。

答案 2 :(得分:6)

来源:https://spring.io/projects/spring-cloud

Spring Cloud发布培训与Spring Boot兼容性

 ------------------------------ 
| Release Train | Boot Version |
| ------------- | ------------ |
| Hoxton        | 2.2.x        |
| Greenwich     | 2.1.x        |
| Finchley      | 2.0.x        |
| Edgware       | 1.5.x        |
| Dalston       | 1.5.x        |
| Camden        | 1.4.x        |
| Brixton       | 1.3.x, 1.4.x |
| Angel         | 1.2.x        |
 --------------- --------------

答案 3 :(得分:6)

2020年,找到最新的匹配版本仍然很麻烦...

  1. https://spring.io/projects/spring-cloud Release Trains表中查找,然后选择所需的Spring Boot版本和Spring Cloud Release Train。
    截至2020-08-05的发行列车:
    Release trains as of 2020-08-05
  2. https://github.com/spring-projects/spring-boot/releases中找到最新的匹配Spring Boot版本。
  3. https://github.com/spring-cloud/spring-cloud-release/releases中找到最新的匹配的Spring Cloud Release Train版本

另一个信息来源是Spring Blog类别“发布”:https://spring.io/blog/category/releases,但是恕我直言,这有点...令人困惑。