SpringBoot3.4.0和OpenFeign4.1.4不兼容

SpringBoot3.4.0和OpenFeign4.1.4不兼容

SpringBoot升级到3.4.0版本,和OpenFeign不兼容,maven install 时报错,即使OpenFeign升到最新版本4.1.4,依然不兼容。

SpringBoot版本降为3.3.6 ,maven install 成功。

创建日期:2024年11月28日 星期四

Maven install 报错信息

2024-11-28T19:28:25.679+08:00  WARN 12536 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compositeCompatibilityVerifier' defined in class path resource [org/springframework/cloud/configuration/CompatibilityVerifierAutoConfiguration.class]: Failed to instantiate [org.springframework.cloud.configuration.CompositeCompatibilityVerifier]: Factory method 'compositeCompatibilityVerifier' threw exception with message: Spring Cloud/ Spring Boot version compatibility checks have failed: [[VerificationResult@d6b532f description = 'Spring Boot [3.4.0] is not compatible with this Spring Cloud release train', action = 'Change Spring Boot version to one of the following versions [3.2.x, 3.3.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]']]
============================
CONDITIONS EVALUATION REPORT
============================

报错分析(AI问答)

这个错误信息表明在尝试初始化Spring Boot应用时,Spring Cloud的兼容性检查失败了。具体来说,你当前使用的Spring Boot版本(3.4.0)与你的Spring Cloud版本不兼容。

错误详情:

  • 错误描述Spring Boot [3.4.0] is not compatible with this Spring Cloud release train
  • 建议操作:更改Spring Boot的版本到以下之一:3.2.x, 3.3.x
  • 可选方案:如果不想更改Spring Boot版本,可以禁用兼容性检查,通过设置属性spring.cloud.compatibility-verifier.enabled=false

解决方法:

  1. 更改Spring Boot版本:你可以根据提示将Spring Boot的版本更改为3.2.x或3.3.x中的一个,以确保与当前使用的Spring Cloud版本兼容。
  2. 禁用兼容性检查:如果你希望继续使用当前的Spring Boot版本,并且愿意承担可能因此带来的兼容性问题,可以在配置文件中添加以下配置来禁用兼容性检查:
    spring:
      cloud:
        compatibility-verifier:
          enabled: false
    
  3. 更新Spring Cloud版本:另一个解决方案是查找并使用与Spring Boot 3.4.0兼容的Spring Cloud版本。通常,每个Spring Boot主要版本都有对应的Spring Cloud版本。你可以访问Spring Cloud项目页面查看版本兼容性表,找到合适的Spring Cloud版本进行更新。

选择上述任一方法解决兼容性问题后,重新构建和运行你的应用程序,应该可以解决这个问题。

不兼容版本

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.4.0</version>
    </parent>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
    <version>4.1.4</version>
</dependency>


### Spring Boot 3.4.0 版本特性 Spring Boot 3.4.0引入了一系列重要的变更改进,旨在提升性能、安全性开发者体验。以下是该版本的主要特性更新: #### 移除已弃用功能 在Spring Boot 3.2中标记为废弃并在3.4中正式移除的部分类、方法属性已经被彻底删除[^2]。这意味着任何依赖于这些组件的应用程序都需要进行相应的调整。 #### 提升兼容性支持 针对第三方库的支持也有所增强,特别是对于那些广泛使用的API文档工具如Knife4j,在升级至Spring Boot 3.4之后可能会遇到`java.lang.NoSuchMethodError`异常的情况。对此提供了一个特定的解决方案,即通过集成最新版的`knife4j-openapi3-jakarta-spring-boot-starter`来解决问题[^1]: ```xml <dependency> <groupId>com.github.xingfudeshi</groupId> <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId> <version>4.6.0</version> </dependency> ``` #### 日志管理优化 结构化日志作为新加入的功能之一,能够帮助更高效地收集分析应用程序的日志数据,从而简化调试过程并提高运维效率。 --- ### 常见问题及其解决方案 当面对诸如`Handler dispatch failed: java.lang.NoSuchMethodError`这样的错误时,除了上述提到的方法外,还应该考虑以下几个方面可能存在的原因及对策: - **检查依赖冲突**:确保项目中的所有依赖项都是最新的,并且相互之间不存在版本不匹配的问题。 - **清理缓存文件**:有时候IDE或构建工具内部残留的历史编译产物也会引发此类问题,尝试清除本地仓库后再重新下载所需资源。 - **审查配置参数**:确认应用启动所需的各项设置均正确无误,比如服务器监听地址/端口等基本信息是否合理设定。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宋冠巡

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值