I'm in the midst of upgrading an app from Spring Boot 1.x to Spring Boot 2.x. When I attempted to run an existing (and previously working) unit test, I saw the following output:
***************************
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 project uses the following implementation: 'org.springframework.cloud:spring-cloud-sleuth-core:2.2.8.RELEASE'
I tried checking with the Gradle dependencies task to make sure there were no conflicting versions of spring-cloud-sleuth-core and friends. I also looked at this post and this post and they didn't solve my problem.
I need to avoid overriding beans, and I'm currently constrained to Spring Boot 2.4.x for my deploy target.