【问题标题】:Is there a compatibility matrix of Spring-boot and Spring-cloud?是否有 Spring-boot 和 Spring-cloud 的兼容性矩阵?
【发布时间】:2017-07-28 08:20:00
【问题描述】:

我想知道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 的 sn-ps

<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 结合使用通常对我来说效果很好。

【问题讨论】:

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


    【解决方案1】:

    2021 年 12 月更新

    Spring Cloud 发布火车 Spring Boot 兼容性

    Compatibility Matrix
    Spring Cloud Spring Boot
    2021.0.0 2.6.1
    2021.0.0-M2 2.6.0-M3
    2020.0.3+ 2.4.x, 2.5.x
    2020.0.x 2.4.x
    Ilford 2.4.x
    Hoxton.SR5+ 2.2.x, 2.3.x
    Hoxton 2.2.x
    ⚠ Below Spring Cloud versions have all reached end of life status and are no longer supported.
    Spring Cloud Spring Boot
    Greenwich 2.1.x
    Finchley 2.0.x
    Edgware 1.5.x
    Dalston 1.5.x
    Camden.SR5+ 1.4.x, 1.5.x
    Camden 1.4.x
    Brixton 1.3.x, 1.4.x
    Angel 1.2.x

    来源:

    1. Spring Cloud项目页面
    2. Spring Cloud 2021.0.0-M2 (codename Jubilee) is Available
    3. Spring Cloud 2021.0.0 (codename Jubilee) Has Been Released
    4. Spring Cloud Roadmap and EOL Announcements

    【讨论】:

      【解决方案2】:

      2021 年,要找到 最新 匹配的 Spring Boot 和 Spring Cloud 版本仍然很乏味......这里有一个过程:

      1. https://spring.io/projects/spring-cloudRelease Trains 表中查找兼容性矩阵,它显示了哪些 Spring Boot 和 Spring Cloud Release Train 版本匹配。截至 2021 年 12 月 14 日发布火车:

      2. 单击“Release Train”列中的链接以访问 Spring Cloud 发行说明,其中提到了最新的“Release Train”版本。
        例如:“Hoxton ==> Hoxton.SR12”。

        或者:
        https://github.com/spring-cloud/spring-cloud-release/tags 中查找最新匹配的 Spring Cloud Release Train 版本。
      3. 从“Boot Version”列中选择值并在 Spring Boot 版本中查找最高匹配版本,此处:https://github.com/spring-projects/spring-boot/releases 或(更快)此处:https://github.com/spring-projects/spring-boot/tags
        示例继续:“==> v2.3.12.RELEASE”。

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

      【讨论】:

        【解决方案3】:

        这里是release train Spring Boot compatibility table。在表格下方,有一条注释指出,Camden 发布系列是基于 Spring Boot 1.4.x 构建的,但也使用 1.5.x 进行了测试。

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

        Spring Cloud Camden builds on Spring Boot 1.4.x.

        但后来:

        Adds Boot 1.5 compatibility and breaks Boot 1.3 compatibility

        【讨论】:

        • 谢谢。您曾说过“Camden 发布系列与 Spring Boot 1.5.x 不兼容”。您引用的 Camden Releases notes 链接指出以下内容 - 添加 Boot 1.5 兼容性并破坏 Boot 1.3 兼容性。快速入门还说明了相同的信息 - Camden 发布系列基于 Spring Boot 1.4.x 构建,但也使用 1.5.x 进行了测试。
        • Camden.SR5 开始,Camden 发布序列将与 Boot 1.5 兼容。
        【解决方案4】:

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

        它包含的库​​不仅仅是 spring-cloud,但不是每一个。

        【讨论】:

        • 非常好用,但是有没有办法查询老版本,比如Spring Boot 2.3.7?
        猜你喜欢
        • 2023-04-08
        • 2019-05-01
        • 2020-09-03
        • 2021-05-21
        • 2021-08-25
        • 2019-02-27
        • 1970-01-01
        • 2021-12-16
        • 1970-01-01
        相关资源
        最近更新 更多