I had an issue during the migration of a project from Spring Boot version 3.1.5 to 3.2.0.

In 3.1.5 the Spring boot test suite was providing a "default" tracer. I was not able to find the configuration who was adding this tracer. (May be this one ? https://github.com/spring-projects/spring-boot/blob/07d8c996058b70d5a19a7ee302a99c2c97f94367/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/actuate/observability/ObservabilityContextCustomizerFactory.java#L108)

In Spring Boot 3.2.0, no default Tracer is configured. Is this a regression or a wanted behavior ? Maybe this change need to be documented if it's a wanted behavior ?

I've fixed my project by adding an tracer implementation (micrometer-tracing-bridge-otel in my case) and by migrating from the @WebMvcTest annotation to the @SpringBootTest annotation + @AutoConfigureMockMvc annotation

Comment From: wilkinsona

Thanks for the report. This change in behavior is a side-effect of https://github.com/spring-projects/spring-boot/issues/35354. For what were you using the Tracer API in a @WebMvcTest? It may be that we need to refine the auto-configurations that are included in the @WebMvcTest slice.

Comment From: wyfrel

Hello Wilkinsona, i'm testing the behavior of an "Exception Handler" of my Rest service. I'm adding the trace information (traceId / SpanId ) of the request in the Response during the exception handling

Comment From: DuncanCasteleyn

We are also running into this problem, we rely on tracer to be present during tests, our tests fail since Spring Boot 3.2.0

Comment From: wilkinsona

We discussed this today. We think we may be able to modify @AutoConfigureObservability so that it can be used to opt into the auto-configuration of tracing and metrics in a sliced-test that otherwise would not have a Tracer or MeterRegistry available.

Comment From: mhalbritter

@AutoConfigureObservability can now be applied to sliced tests. If done so, it will auto-configure an in-memory MeterRegistry, a no-op Tracer and an ObservationRegistry.

Another thing I've changed: if Micrometer Tracing is on the classpath, there's now always a Tracer in the context (for symmetry with MeterRegistry and ObservationRegistry, which are always available, too). If neither Brave nor Otel supplies a Tracer, a no-op tracer is auto-configured.