簡體   English   中英

是否有 Spring-boot 和 Spring-cloud 的兼容性矩陣?

[英]Is there a compatibility matrix of Spring-boot and 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>

將 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 結合使用通常對我來說效果很好。

2022 年 3 月更新

Spring Cloud 發布火車 Spring Boot 兼容性

兼容性矩陣
春雲 彈簧靴
2022.0.0-M1 3.0.0-M1
2021.0.x 又名禧年 2.6.x
2021.0.0-M2 2.6.0-M3
2020.0.3+ 又名伊爾福德 2.4.x、2.5.x
2020.0.x 又名 Ilford 2.4.x
⚠ Spring Cloud 以下版本均已停產,不再支持。
春雲 彈簧靴
霍斯頓.SR5+ 2.2.x,2.3.x
霍克斯頓 2.2.x
格林威治 2.1.x
芬奇利 2.0.x
埃奇韋爾 1.5.x
達爾斯頓 1.5.x
卡姆登.SR5+ 1.4.x、1.5.x
卡姆登 1.4.x
布里克斯頓 1.3.x,1.4.x
天使 1.2.x

資料來源:

  1. Spring Cloud項目頁面
  2. Spring Cloud 2021.0.0-M2(代號Jubilee)上市
  3. Spring Cloud 2021.0.0(代號Jubilee)已經發布
  4. Spring Cloud 路線圖和 EOL 公告
  5. 2022.0.0-M1 PRE參考文檔

這是發布火車 Spring Boot 兼容性表 在表格下方,有一條注釋指出,Camden 發布系列是基於 Spring Boot 1.4.x 構建的,但也使用 1.5.x 進行了測試。

您還可以閱讀每個版本的發行說明,其中說明了兼容的組件版本:

Spring Cloud Camden 基於 Spring Boot 1.4.x 構建。

但后來:

添加 Boot 1.5 兼容性並破壞 Boot 1.3 兼容性

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

它包含的庫​​不僅僅是 spring-cloud,但不是每個庫。

2021年了,找Spring Boot和Spring Cloud的最新匹配版本還是很麻煩……這里有一個過程:

  1. https://spring.io/projects/spring-cloud Release Trains表中查找兼容性矩陣,它顯示了哪些 Spring Boot 和 Spring Cloud Release Train 版本匹配。 截至 2022-05-19 發布火車:

    截至 2022 年 5 月 19 日春季發布火車的截圖
  2. 單擊“Release Train”列中的鏈接以訪問 Spring Cloud 發行說明,其中提到了最新的“Release Train”版本。
    例如:“ Hoxton ==> Hoxton.SR12 ”。

    或者:
    https://github.com/spring-cloud/spring-cloud-release/tags中找到最新的匹配 Spring Cloud Release Train 版本。
  3. 從“啟動版本”列中選擇值並在 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,但恕我直言,這有點......令人困惑。

我找到了一種方法來獲得 spring boot 和 spring cloud 之間的確切版本兼容性。

只需訪問此 URL: https ://start.spring.io/actuator/info

spring-cloud": {
"Hoxton.SR12": "Spring Boot >=2.2.0.RELEASE and <2.4.0.M1",
"2020.0.5": "Spring Boot >=2.4.0.M1 and <2.6.0-M1",
"2021.0.0-M1": "Spring Boot >=2.6.0-M1 and <2.6.0-M3",
"2021.0.0-M3": "Spring Boot >=2.6.0-M3 and <2.6.0-RC1",
"2021.0.0-RC1": "Spring Boot >=2.6.0-RC1 and <2.6.1",
"2021.0.1": "Spring Boot >=2.6.1 and <2.6.5-SNAPSHOT",
"2021.0.2-SNAPSHOT": "Spring Boot >=2.6.5-SNAPSHOT and <3.0.0-M1",
"2022.0.0-M1": "Spring Boot >=3.0.0-M1 and <3.1.0-M1"
},

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM