I hope you’re all doing well. I’ve been diligently upgrading my UI project to Spring Boot 3, and I’ve encountered a snag. Specifically, I’m encountering an exception: “No qualifying bean of type ‘org.springframework.cloud.sleuth.CurrentTraceContext'”
SleuthFeignBuilder.builder(beanFactory, client)
.encoder(new JacksonEncoder(objectMapper))
.decoder(new JacksonDecoder(objectMapper))
.logger(new Slf4jLogger())
.errorDecoder(new MyProjectErrorDecoder(objectMapper))
.requestInterceptor(headerInterceptor)
.options(TIMEOUT_OPTIONS)
.target(clazz, myProjectControllerURL);
Upon further investigations I found that
Spring Cloud Sleuth will not work with Spring Boot 3.x onward. The
last major version of Spring Boot that Sleuth will support is 2.x.
Spring Cloud Sleuth Reference Documentation
I tried to use micrometer tracing as mentioned in the given link by importing the required package in my build.gradle file
implementation 'io.micrometer:micrometer-tracing-bridge-brave:1.2.4'
and updated the above code from SleuthFeignBuilder to Feign as
Feign.builder()
.client(client)
.encoder(new JacksonEncoder(objectMapper))
.decoder(new JacksonDecoder(objectMapper))
.logger(new Slf4jLogger())
.errorDecoder(new MyProjectErrorDecoder(objectMapper))
.requestInterceptor(headerInterceptor)
.options(TIMEOUT_OPTIONS)
.addCapability(new MicrometerCapability(registry))
.target(clazz, myProjectControllerURL);
I’ve observed that the traceId and spanId are being generated successfully in my UI project (post using micrometer). However, I’m unable to locate the same traceId in the controller.
Could someone kindly point me in the right direction to resolve this issue? Any insights or suggestions would be greatly appreciated.
Thank you in advance for your time and assistance. If there’s any oversight on my part, please accept my apologies.