You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot 2.6与Spring Cloud Sleuth 3.1.4兼容冲突疑问

问题分析与解决方案

首先明确:Spring Cloud 2021.0.x(代号Jubilee)确实兼容Spring Boot 2.6.x,而Sleuth 3.1.4属于该版本列车,出现报错大概率是项目依赖配置存在问题,常见原因及解决方式如下:

  • 未正确引入Spring Cloud BOM
    若仅手动指定Sleuth版本,却未在依赖管理中引入Spring Cloud 2021.0.x的BOM,会导致其他Spring Cloud组件(如Spring Cloud Commons)自动拉取与Sleuth版本不匹配的旧版本,进而触发兼容性校验报错。需在项目构建文件中添加对应BOM,确保所有Spring Cloud组件版本统一。

    Maven配置示例:

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2021.0.4</version> <!-- 与Sleuth 3.1.4匹配的Jubilee稳定版本 -->
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    
  • Spring Boot 2.6.0的适配问题
    Spring Cloud 2021.0.x对Spring Boot 2.6.0的兼容性存在小瑕疵,官方在2.6.1及以上版本完成了适配修复。建议将Spring Boot版本升级至2.6.x系列的稳定版本(如2.6.14),同时保持Spring Cloud BOM版本与Sleuth版本匹配。

  • 混合不同版本的Spring Cloud组件
    检查项目依赖中是否存在其他Spring Cloud组件(如Spring Cloud Config、Spring Cloud Gateway等),若这些组件版本不属于2021.0.x列车,会导致依赖版本混乱,触发兼容性检查失败。确保所有Spring Cloud组件通过BOM统一管理版本,避免手动指定单个组件版本。

若以上方案均无效,可临时关闭兼容性校验(不推荐长期使用),在配置文件中添加:

spring.cloud.compatibility-verifier.enabled=false

内容的提问来源于stack exchange,提问作者dev-rifaii

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 08:35:30