欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決springboot與springcloud版本兼容問(wèn)題(附版本兼容表)

 更新時(shí)間:2024年02月25日 14:29:02   作者:寒山李白  
在基于spring boot搭建spring cloud時(shí),創(chuàng)建eureka后啟動(dòng)服務(wù)發(fā)生報(bào)錯(cuò),本文給大家介紹了解決springboot與springcloud版本兼容問(wèn)題的幾種方案,需要的朋友可以參考下

1. 場(chǎng)景描述(產(chǎn)生環(huán)境)

在基于spring boot搭建spring cloud時(shí),創(chuàng)建eureka后啟動(dòng)服務(wù)發(fā)生報(bào)錯(cuò),報(bào)錯(cuò)內(nèi)容如下,如覺(jué)得繁瑣可直接看第三步解決方法進(jìn)行嘗試,或可直接解決問(wèn)題。

注: 使用zuul的場(chǎng)景有些特殊,所以放在最后講,如果是zuul使用的報(bào)錯(cuò)請(qǐng)移步5

2. 報(bào)錯(cuò)代碼(控制臺(tái))

2.1 報(bào)錯(cuò)1

Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Bean

試了幾次,有時(shí)候還會(huì)出現(xiàn)下面的報(bào)錯(cuò)-報(bào)錯(cuò)2

2.2 報(bào)錯(cuò)2

Could not find artifact org.springframework.cloud:spring-cloud-starter-netflix-eureka-server:pom:2021.0.5 in alimaven (http://maven.aliyun.com/nexus/content/groups/public/)

兩個(gè)版本都能對(duì)應(yīng)上之后啟動(dòng)項(xiàng)目又出現(xiàn)了新的報(bào)錯(cuò)-報(bào)錯(cuò)3

2.3 報(bào)錯(cuò)3

org.springframework.cloud:spring-cloud-starter-netflix-eureka-server:jar:unknown was not found in http://maven.aliyun.com/nexus/content/groups/public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of alimaven has elapsed or updates are forced

如果報(bào)錯(cuò)3的問(wèn)題也解決了,這個(gè)時(shí)候使用的兩個(gè)不兼容的版本,如果刷新依賴也沒(méi)報(bào)錯(cuò)的話,啟動(dòng)項(xiàng)目后正常會(huì)報(bào)下面的錯(cuò),如報(bào)錯(cuò)4

2.4 報(bào)錯(cuò)4

使用springboot2.7.3和springcloud2020.0.5后啟動(dòng)項(xiàng)目出現(xiàn)如下報(bào)錯(cuò)

Action:

Consider applying the following actions:

- Change Spring Boot version to one of the following versions [2.4.x, 2.5.x] .
You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn]. 
If you want to learn more about the Spring Cloud Release train compatibility, you can visit this page [https://spring.io/projects/spring-cloud#overview] and check the [Release Trains] section.
If you want to disable this check, just set the property [spring.cloud.compatibility-verifier.enabled=false]

3. 解決方法

3.1 針對(duì)報(bào)錯(cuò)1、報(bào)錯(cuò)2、報(bào)錯(cuò)4的解決

百度后確定是版本不兼容問(wèn)題,于是按照網(wǎng)上某博主版本列表配對(duì),本章末尾附版本對(duì)照表可供參考。

我使用的版本是spring boot的2.7.3以及spring cloud的2021.0.5
還試了

spring boot的2.5.3以及spring cloud的2020.0.5

spring boot的2.1.4.RELEASE以及spring cloud的Greenwich.RELEASE

這三個(gè)版本都是親測(cè)可用的(順利起了服務(wù)并訪問(wèn)成功)

3.2 針對(duì)報(bào)錯(cuò)3的解決

版本確定沒(méi)配錯(cuò),那么這個(gè)報(bào)錯(cuò)3如果發(fā)生了,可以按照如下解決
在依賴中添加type和scope標(biāo)簽,如下

在父類pom.xml中配置如下

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.3</version>
    </parent>

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

雖然不知道原理,但的確解決了報(bào)錯(cuò)3這個(gè)問(wèn)題

4. 總結(jié)

正常版本兼容問(wèn)題常常發(fā)生,所以一般使用偏老一點(diǎn)的依賴來(lái)用會(huì)減少一些問(wèn)題,但很多情況下即使使用老的版本也會(huì)出現(xiàn)問(wèn)題。

只要按照下面的方式來(lái)配置一般不會(huì)有毛病。

父項(xiàng)目pom.xml中的配置添加如下:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.3</version>
    </parent>

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

子模塊項(xiàng)目的pom.xml配置如下:

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
    </dependencies>

5. zuul使用的報(bào)錯(cuò)與解決

使用兼容列表里對(duì)應(yīng)的spring boot和spring cloud版本后,springcloud中的eureka等其他功能正常,但使用zuul時(shí)啟動(dòng)zuul服務(wù)后出現(xiàn)了報(bào)錯(cuò),此時(shí)可嘗試使用以下兩個(gè)版本:spring boot 的2.2.4.RELEASE和spring cloud 的Hoxton.SR12一般可解決問(wèn)題

我遇到的是如下報(bào)錯(cuò):

org.springframework.cloud:spring-cloud-starter-netflix-zuul:jar:unknown was not found in http://maven.aliyun.com/nexus/content/groups/public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of alimaven has elapsed or updates are forced

以上兩個(gè)報(bào)錯(cuò)都可將springboot和spring cloud的版本換為上面推薦的2.2.4.RELEASE和Hoxton.SR12即可解決問(wèn)題

6. spring boot和spring cloud版本兼容表

SpringCloud版本SpringBoot版本
2022.0.0-M2Spring Boot >=3.0.0-M2 and < 3.1.0-M1
2022.0.0-M1Spring Boot >=3.0.0-M1 and < 3.0.0-M2
2021.0.3Spring Boot >=2.6.1 and < 3.0.0-M1
2021.0.0-RC1Spring Boot >=2.6.0-RC1 and <2.6.1
2021.0.0-M3Spring Boot >=2.6.0-M3 and <2.6.0-RC1
2021.0.0-M1Spring Boot >=2.6.0-M1 and <2.6.0-M3
2020.0.5Spring Boot >=2.4.0.M1 and <2.6.0-M1
Hoxton.SR12Spring Boot >=2.2.0.RELEASE and <2.4.0.M1
Hoxton.BUILD-SNAPSHOTSpring Boot >=2.2.0.BUILD-SNAPSHOT
Hoxton.M2Spring Boot >=2.2.0.M4 and <=2.2.0.M5
Greenwich.BUILD-SNAPSHOSpring Boot >=2.1.9.BUILD-SNAPSHOT and <2.2.0.M4
Greenwich.SR2Spring Boot >=2.1.0.RELEASE and <2.1.9.BUILD-SNAPSHOT
Greenwich.M1Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE
Finchley.BUILD-SNAPSHOTSpring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3
Finchley.SR4Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT
Finchley.RC2Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE
Finchley.RC1Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE
Finchley.M9Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE
Finchley.M7Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2
Finchley.M6Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1
Finchley.M5Spring Boot >=2.0.0.M7 and <=2.0.0.M7
Finchley.M4Spring Boot >=2.0.0.M6 and <=2.0.0.M6
Finchley.M3Spring Boot >=2.0.0.M5 and <=2.0.0.M5
Finchley.M2Spring Boot >=2.0.0.M3 and <2.0.0.M5
Edgware.SR51.5.20.RELEASE
Edgware.SR51.5.16.RELEASE
Edgware.RELEASE1.5.9.RELEASE
Dalston.RC11.5.2.RELEASE

以上就是解決springboot與springcloud版本兼容問(wèn)題(附版本兼容表)的詳細(xì)內(nèi)容,更多關(guān)于springboot與springcloud版本兼容的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • 深入理解Spring AOP

    深入理解Spring AOP

    這篇文章主要介紹了深入理解Spring AOP,詳細(xì)的介紹了spring aop的具體實(shí)現(xiàn)與理論
    2017-01-01
  • Java中泛型學(xué)習(xí)之細(xì)節(jié)篇

    Java中泛型學(xué)習(xí)之細(xì)節(jié)篇

    泛型在java中有很重要的地位,在面向?qū)ο缶幊碳案鞣N設(shè)計(jì)模式中有非常廣泛的應(yīng)用,下面這篇文章主要給大家介紹了關(guān)于Java中泛型細(xì)節(jié)的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-02-02
  • SpringBoot+JWT實(shí)現(xiàn)單點(diǎn)登錄完美解決方案

    SpringBoot+JWT實(shí)現(xiàn)單點(diǎn)登錄完美解決方案

    單點(diǎn)登錄是一種統(tǒng)一認(rèn)證和授權(quán)機(jī)制,指在多個(gè)應(yīng)用系統(tǒng)中,用戶只需要登錄一次就可以訪問(wèn)所有相互信任的系統(tǒng),不需要重新登錄驗(yàn)證,這篇文章主要介紹了SpringBoot+JWT實(shí)現(xiàn)單點(diǎn)登錄解決方案,需要的朋友可以參考下
    2023-07-07
  • java后端調(diào)用第三方接口返回圖片流給前端的具體代碼實(shí)現(xiàn)

    java后端調(diào)用第三方接口返回圖片流給前端的具體代碼實(shí)現(xiàn)

    在前后端分離的開(kāi)發(fā)中,經(jīng)常會(huì)遇到需要從后端返回圖片流給前端的情況,下面這篇文章主要給大家介紹了關(guān)于java后端調(diào)用第三方接口返回圖片流給前端的具體代碼實(shí)現(xiàn),需要的朋友可以參考下
    2024-02-02
  • Java8新特性之精簡(jiǎn)的JRE詳解_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    Java8新特性之精簡(jiǎn)的JRE詳解_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    這篇文章主要介紹了Java8新特性之精簡(jiǎn)的JRE詳解的相關(guān)資料,需要的朋友可以參考下
    2017-06-06
  • Java關(guān)鍵字finally_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    Java關(guān)鍵字finally_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    java關(guān)鍵字finally不管是否出現(xiàn)異常,finally子句總是在塊完成之前執(zhí)行。下面通過(guò)實(shí)現(xiàn)代碼給大家介紹Java關(guān)鍵字finally相關(guān)知識(shí),需要的的朋友參考下吧
    2017-04-04
  • 解決@FeignClient注入service失敗問(wèn)題

    解決@FeignClient注入service失敗問(wèn)題

    這篇文章主要介紹了解決@FeignClient注入service失敗問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-03-03
  • SpringBoot基于MyBatis-Plus實(shí)現(xiàn)Lambda Query查詢的示例代碼

    SpringBoot基于MyBatis-Plus實(shí)現(xiàn)Lambda Query查詢的示例代碼

    MyBatis-Plus 是 MyBatis 的增強(qiáng)工具,簡(jiǎn)化了數(shù)據(jù)庫(kù)操作,并提高了開(kāi)發(fā)效率,它提供了多種查詢方式,包括常規(guī)的 SQL 查詢、Lambda Query 查詢、分頁(yè)查詢、條件查詢等,在本篇博客中,我們將詳細(xì)講解如何使用 MyBatis-Plus 的各種查詢方式,需要的朋友可以參考下
    2025-01-01
  • Java實(shí)現(xiàn)Redis的集合(set)命令操作

    Java實(shí)現(xiàn)Redis的集合(set)命令操作

    這篇文章主要介紹了Java實(shí)現(xiàn)Redis的集合(set)命令操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-07-07
  • MAC下基于maven使用IDEA走讀TestNG源碼解析

    MAC下基于maven使用IDEA走讀TestNG源碼解析

    這篇文章主要介紹了MAC下基于maven使用IDEA走讀TestNG源碼,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-06-06

最新評(píng)論