JavaBean的春天。侦探。baggagekeys已定义
我正在从Spring Boot 1升级一个应用程序。x到弹簧护套2。x、 当我尝试运行一个现有(和以前工作的)单元测试时,我看到了以下输出:
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'spring.sleuth.baggage-keys', defined in class path resource [org/springframework/cloud/sleuth/autoconfig/brave/BraveBaggageConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/sleuth/autoconfig/TraceBaggageConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
My Gradle项目使用以下实现:'org.springframework.cloud:spring-cloud-sleuth-core:2.2.8.RELEASE'
我尝试与the Gradle dependencies task进行检查,以确保SpringCloudSleuthCore和friends的版本没有冲突。我还研究了this post和this post,它们并没有解决我的问题
我需要避免重写bean,目前我只能使用SpringBoot2.4。x作为我的部署目标
# 1 楼答案
检查compatibility matrix,您应该使用Spring Cloud 2020.0。x又名Ilford(Sleuth 3.x),带弹簧靴2.4(或2.5)
Sleuth 2.2.8是Spring Cloud Hoxton,它与Boot 2.4不兼容