spring boot与spring cloud版本兼容问题解决(附版本兼容表)

这篇具有很好参考价值的文章主要介绍了spring boot与spring cloud版本兼容问题解决(附版本兼容表)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

天行健,君子以自强不息;地势坤,君子以厚德载物。


每个人都有惰性,但不断学习是好好生活的根本,共勉!


文章均为学习整理笔记,分享记录为主,如有错误请指正,共同学习进步。

以下为解决报错问题,如果看完还不能解决,可以参考下面这篇文章搭建spring cloud
spring cloud搭建

1. 场景描述(产生环境)

在基于spring boot搭建spring cloud时,创建eureka后启动服务发生报错,报错内容如下,如觉得繁琐可直接看第三步解决方法进行尝试,或可直接解决问题。
注: 使用zuul的场景有些特殊,所以放在最后讲,如果是zuul使用的报错请移步5

2. 报错代码(控制台)

2.1 报错1

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

试了几次,有时候还会出现下面的报错-报错2

2.2 报错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/)

两个版本都能对应上之后启动项目又出现了新的报错-报错3

2.3 报错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

如果报错3的问题也解决了,这个时候使用的两个不兼容的版本,如果刷新依赖也没报错的话,启动项目后正常会报下面的错,如报错4

2.4 报错4

使用springboot2.7.3和springcloud2020.0.5后启动项目出现如下报错

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]

spring boot与spring cloud版本兼容问题解决(附版本兼容表),# springcloud,# spring boot,BaseAndView,spring cloud,spring boot,eureka


3. 解决方法

3.1 针对报错1、报错2、报错4的解决

百度后确定是版本不兼容问题,于是按照网上某博主版本列表配对,本章末尾附版本对照表可供参考。

我使用的版本是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
这三个版本都是亲测可用的(顺利起了服务并访问成功)

3.2 针对报错3的解决

版本确定没配错,那么这个报错3如果发生了,可以按照如下解决
在依赖中添加type和scope标签,如下
在父类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>

虽然不知道原理,但的确解决了报错3这个问题

4. 总结

正常版本兼容问题常常发生,所以一般使用偏老一点的依赖来用会减少一些问题,但很多情况下即使使用老的版本也会出现问题。
只要按照下面的方式来配置一般不会有毛病。
父项目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>

子模块项目的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使用的报错与解决

使用兼容列表里对应的spring boot和spring cloud版本后,springcloud中的eureka等其他功能正常,但使用zuul时启动zuul服务后出现了报错,此时可尝试使用以下两个版本:spring boot 的2.2.4.RELEASE和spring cloud 的Hoxton.SR12一般可解决问题
我遇到的是如下报错:

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

或者以下报错:

Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]

以上两个报错都可将springboot和spring cloud的版本换为上面推荐的2.2.4.RELEASE和Hoxton.SR12即可解决问题

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

这是参考的一位博主的表格,对于更详细的版本介绍请移步这位博主的文章:spring cloud版本介绍文章来源地址https://www.toymoban.com/news/detail-543804.html

SpringCloud版本 SpringBoot版本
2022.0.0-M2 Spring Boot >=3.0.0-M2 and < 3.1.0-M1
2022.0.0-M1 Spring Boot >=3.0.0-M1 and < 3.0.0-M2
2021.0.3 Spring Boot >=2.6.1 and < 3.0.0-M1
2021.0.0-RC1 Spring Boot >=2.6.0-RC1 and <2.6.1
2021.0.0-M3 Spring Boot >=2.6.0-M3 and <2.6.0-RC1
2021.0.0-M1 Spring Boot >=2.6.0-M1 and <2.6.0-M3
2020.0.5 Spring Boot >=2.4.0.M1 and <2.6.0-M1
Hoxton.SR12 Spring Boot >=2.2.0.RELEASE and <2.4.0.M1
Hoxton.BUILD-SNAPSHOT Spring Boot >=2.2.0.BUILD-SNAPSHOT
Hoxton.M2 Spring Boot >=2.2.0.M4 and <=2.2.0.M5
Greenwich.BUILD-SNAPSHO Spring Boot >=2.1.9.BUILD-SNAPSHOT and <2.2.0.M4
Greenwich.SR2 Spring Boot >=2.1.0.RELEASE and <2.1.9.BUILD-SNAPSHOT
Greenwich.M1 Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE
Finchley.BUILD-SNAPSHOT Spring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3
Finchley.SR4 Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT
Finchley.RC2 Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE
Finchley.RC1 Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE
Finchley.M9 Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE
Finchley.M7 Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2
Finchley.M6 Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1
Finchley.M5 Spring Boot >=2.0.0.M7 and <=2.0.0.M7
Finchley.M4 Spring Boot >=2.0.0.M6 and <=2.0.0.M6
Finchley.M3 Spring Boot >=2.0.0.M5 and <=2.0.0.M5
Finchley.M2 Spring Boot >=2.0.0.M3 and <2.0.0.M5
Edgware.SR5 1.5.20.RELEASE
Edgware.SR5 1.5.16.RELEASE
Edgware.RELEASE 1.5.9.RELEASE
Dalston.RC1 1.5.2.RELEASE

到了这里,关于spring boot与spring cloud版本兼容问题解决(附版本兼容表)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • SpringBoot、SpringCloud、Spring Cloud Alibaba版本对照表(详细准确)

    ❤️一切信息来自官网,准确详细❤️ Spring Cloud Version Spring Boot Version 2022.0.x aka Kilburn 3.0.x 2021.0.x aka Jubilee 2.6.x, 2.7.x (Starting with 2021.0.3) 2020.0.x aka Ilford 2.4.x, 2.5.x (Starting with 2020.0.3) Hoxton 2.2.x, 2.3.x (Starting with SR5) Greenwich 2.1.x Finchley 2.0.x Edgware 1.5.x Dalston 1.5.x Spring Cloud Dalston, Ed

    2024年02月13日
    浏览(30)
  • Spring Boot 的版本与 MyBatis 或其他依赖库的版本不兼容

    报错:java.lang.IllegalArgumentException: Unable to instantiate org.mybatis.spring.boot.autoconfigure.MybatisDependsOnDatabaseInitializationDetector [org.springframework.boot.sql.init.dependency.DependsOnDatabaseInitializationDetector] 检查pom文件之后发现 我 在依赖中使用了 MyBatis Spring Boot Starter 的版本是 3.0.2 ,但 Spring Boot 的

    2024年02月07日
    浏览(29)
  • 高版本Spring Cloud中OpenFeign整合Hystrix熔断降级不生效的问题及解决方案

    本文将介绍在使用高版本Spring Cloud(2020.0.x及以后),由于取消了Hystrix的集成,导致OpenFeign与Hystrix熔断降级不生效的问题。同时,也将给出解决该问题的方案,即添加feign.circuitbreaker.enabled=true配置。 随着Spring Cloud框架的发展,高版本Spring Cloud(2020.0.x及以上)中取消了对Hy

    2024年02月22日
    浏览(34)
  • 【Spring Cloud】如何确定微服务项目的Spring Boot、Spring Cloud、Spring Cloud Alibaba的版本

    本文描述如何确定微服务项目的Spring Boot、Spring Cloud、Spring Cloud Alibaba的版本。 我们知道Spring Boot、Spring Cloud、Spring Cloud Alibaba的版本选择一致性非常重要。在选择Spring Boot和Spring Cloud版本时,需要考虑到两者之间的关系以及项目的具体需求。 首先,Spring Boot和Spring Cloud有密切

    2024年02月08日
    浏览(36)
  • Spring Boot各版本与Java版本的对应兼容关系,与构建工具(Maven、Gradle)版本的对应兼容关系,对servlet 容器的支持

    by:垃圾程序员 当前文章具有时效性,在当前springboot的版本下做的整合。之后大家视情况可以直接到Spring的官网查看 Spring | Home Level up your Java code and explore what Spring can do for you. https://spring.io/ 下面是Spring Boot各个版本的支持时间 下面是Spring Boot 推荐使用的各个版面,并标注出

    2024年02月10日
    浏览(34)
  • 企业电子招标采购系统源码java 版本 Spring Cloud + Spring Boot

       项目说明 随着公司的快速发展,企业人员和经营规模不断壮大,公司对内部招采管理的提升提出了更高的要求。在企业里建立一个公平、公开、公正的采购环境,最大限度控制采购成本至关重要。符合国家电子招投标法律法规及相关规范,以及审计监督要求;通过电子化

    2024年02月11日
    浏览(39)
  • IDEA 打包报错 maven打包报错 spring-boot-maven-plugin 与spring-boot 版本的兼容性

    报错信息如下: org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 或者 ClassNotFoundException: org.apache.commons.compress.archivers.jar.JarArchiveEntry 解决办法: 排查打包是否使

    2024年02月15日
    浏览(30)
  • Java版本spring cloud + spring boot企业电子招投标系统源代码

     招投标管理系统是一个集门户管理、立项管理、采购项目管理、采购公告管理、考核管理、报表管理、评审管理、企业管理、采购管理和系统管理于一体的综合性应用平台。它适用于招标代理、政府采购、企业采购和工程交易等业务的企业,旨在提高项目管理的效率和质量

    2024年02月02日
    浏览(72)
  • java版本企业电子招标采购系统源码Spring Cloud + Spring Boot +二次开发

      java版本企业电子招标采购系统源码Spring Cloud + Spring Boot +二次开发   一、立项管理 1、招标立项申请 功能点:招标类项目立项申请入口,用户可以保存为草稿,提交。 2、非招标立项申请 功能点:非招标立项申请入口、用户可以保存为草稿、提交。 3、采购立项列表 功能点

    2024年02月06日
    浏览(38)
  • 解决 Spring Cloud 2021.0.5 版本,使用 nacos 做配置中心,报 No spring.config.import property has been defined 的问题

    报错信息如下 Description: No spring.config.import property has been defined Spring 官方给出的解决方案如下 Add a spring.config.import=nacos: property to your configuration. If configuration is not required add spring.config.import=optional:nacos: instead. To disable this check, set spring.cloud.nacos.config.import-check.enabled=false. 这里只

    2024年02月11日
    浏览(43)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包