spring boot java 后端 springboot艰难版本升级之路!! springboot 2.3.x版本升级到2.7.x版本 - 12启动失败,而且没有报错信息
文章目录
1.缘起
1.1 升级到版本2.7.12启动失败,而且没有报错信息
1.2 application-dev.yml 配置加载问题
1.3 openfeign依赖问题汇总
1.4 datasource报错
1.5 MySQL驱动升级
1.6 循环依赖报错
1.7 跨域错误
1.8 springboot升级后,swagger 集成问题
1.9 springboot升级后,DataSource相关问题(shardingJdbc)
1.10 RedisClient版本
临时总结
1.缘起
由于服务需要搭建链路追踪, 需要把springboot版本升级到2.7.12. 目前服务是2.3.x. springboot版本 有几个版本改动是比较大的. 2.4.x/3.0.x 这两个版本具有一定的跨度. 由于我们服务使用springboot的版本太低了. 因此注定升级之路就是不平坦的
下面将我遇到的问题以及解决方案, 一一贴在下面
1.1 升级到版本2.7.12启动失败,而且没有报错信息
步骤:
开始是直接把springboot的版本改到了2.7.12
org.springframework.boot 拼多多帮助力入口
spring-boot-starter-parent
2.7.12
现象:
启动没有任何提示信息,但启动不了.
解决方案:
进过断点调试,发现是springcloud 版本对应有问题,将springcloud的版本改为:2021.0.3并且将 spring-cloud-alibaba.version 的版本改为2021.0.5.0
1.2 application-dev.yml 配置加载问题
现象:
解决方案:
在配置中添加 spring.config.use-legacy-processing: true . 为了兼容老的加载配置文件
1.3 openfeign依赖问题汇总
现象1:
启动接着报错.
Caused by: java.io.FileNotFoundException: class path resource [feign/hystrix/FallbackFactory.class] cannot be opened because it does not exist
现象2:
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class] cannot be opened because it does not exist
解决方案:
升级 openfeign, 以及ribbon版本
3.1.3
2.2.10.RELEASE
org.springframework.cloud
spring-cloud-starter-netflix-ribbon
${ribbon.version}
org.springframework.cloud
spring-cloud-starter-openfeign
${openfeign.version}
1.4 datasource报错
现象:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘webMvcMetricsFilter’ defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method ‘webMvcMetricsFilter’ parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘prometheusMeterRegistry’ defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]: Invocation of init method failed; nested exception is com.baomidou.dynamic.datasource.exception.ErrorCreateDataSourceException: druid create error
好文阅读