'Enable HttpTrace in SpringBoot 2.6.6

I have migrated the service to Spring Boot 2.6.6 and I have this bean configured as follows:

@Bean
fun traceFilterRegistration(filter: HttpTraceFilter) {
        val registration = FilterRegistrationBean(filter)
        registration.urlPatterns = listOf("/prefix1/*", "/prefix2/*")
        return registration
}

This throws an error:

 No qualifying bean of type 'org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter'

I searched and found that this was removed as mentioned here and now requires Spring Cloud Sleuth. However after adding the Spring Cloud Sleuth dependency, I still get the above exception.

Any idea how to enable Http tracing again?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source