关于springboot整合springcloud,springboot降版本报错等问题

2 篇文章 0 订阅
2 篇文章 0 订阅

关于springboot整合springcloud,springboot降版本报错等问题

在整合springcloud的过程中,需要springboot的版本要和springcloud的版本适配,不然会出现一系列的错误:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat’: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationPropertiesBean

这个错误是由于:
一开始springboot项目创建的时候是2.5.0版本,创建的同时选择了openfeign的依赖,创建完成会自动生成一系列springcloud的依赖:
在这里插入图片描述

由于特殊需要降级到了2.1.8.release版本:
在这里插入图片描述
同时改掉test测试类相关的import以及注解等,适应低版本springboot的测试类(这是更改以后的,这些都是低版本需要加上的):

在这里插入图片描述
运行springboot启动类,这个时候还是报错:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat’: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationPropertiesBean

找了一段时间,才想到现在springboot的版本和之前的springcloud的版本不匹配,于是改了springcloud的版本后,再重新启动就可以运行了。

springcloud的版本在springboot 2.5.0降版本之前:
在这里插入图片描述
springboot2.5.0降版本以后修改springcloud版本:
在这里插入图片描述

切记!!!:springboot版本 一定要与 springcloud 对应的版本匹配。具体版本号对应匹配文档,请自行去springcloud官网查看。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值