Hi,

I discovered the following odd issue when adding Observability (the new Micrometer integration in Spring Boot 3) to one of our Spring Boot projects : When I have a MethodValidationPostProcessor defined like here:

@Configuration(proxyBeanMethods = false)
public class AppConfig {

    @Autowired
    private WebClient.Builder webClientBuilder;

    @Bean
    public MethodValidationPostProcessor methodValidationPostProcessor() {
        return new MethodValidationPostProcessor();
    }

    @Bean
    public WebClient webClient() {
        return webClientBuilder.build();
    }
}

there are no traces/spans generated for any of the web client calls. But as soon as I comment out the validation bean the traces are generated 🙄. Another interesting observation is that if I inject the web client builder into the bean method instead of auto wiring:

@Configuration(proxyBeanMethods = false)
public class AppConfig {

    @Bean
    public MethodValidationPostProcessor methodValidationPostProcessor() {
        return new MethodValidationPostProcessor();
    }

    @Bean
    public WebClient webClient(WebClient.Builder webClientBuilder) {
        return webClientBuilder.build();
    }
}

then even with the validation bean in place the tracing works too.

Minimal sample project (Spring Boot 3.2.2) to reproduce: https://github.com/dflachbart/sample-service

Comment From: wilkinsona

There are numerous warnings when you start the app that suggest how to fix the problem:

2024-02-05T08:07:11.138Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration' of type [org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.143Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration' of type [org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.146Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorFactoryConfiguration$ReactorNetty' of type [org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorFactoryConfiguration$ReactorNetty] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.148Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.reactor.netty.ReactorNettyConfigurations$ReactorResourceFactoryConfiguration' of type [org.springframework.boot.autoconfigure.reactor.netty.ReactorNettyConfigurations$ReactorResourceFactoryConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.156Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'spring.reactor.netty-org.springframework.boot.autoconfigure.reactor.netty.ReactorNettyProperties' of type [org.springframework.boot.autoconfigure.reactor.netty.ReactorNettyProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.226Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'reactorResourceFactory' of type [org.springframework.http.client.ReactorResourceFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.228Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'reactorClientHttpConnectorFactory' of type [org.springframework.boot.autoconfigure.web.reactive.function.client.ReactorClientHttpConnectorFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.534Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'webClientHttpConnector' of type [org.springframework.http.client.reactive.ReactorClientHttpConnector] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.535Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'webClientHttpConnectorCustomizer' of type [org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration$$Lambda/0x00000001203b9298] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.535Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration$WebClientCodecsConfiguration' of type [org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration$WebClientCodecsConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.536Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$DefaultCodecsConfiguration' of type [org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$DefaultCodecsConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.538Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'spring.codec-org.springframework.boot.autoconfigure.codec.CodecProperties' of type [org.springframework.boot.autoconfigure.codec.CodecProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.538Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'defaultCodecCustomizer' of type [org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$DefaultCodecsConfiguration$$Lambda/0x00000001203b94b8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.539Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$JacksonCodecConfiguration' of type [org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$JacksonCodecConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.539Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration' of type [org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.540Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration' of type [org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.542Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration' of type [org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.544Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties' of type [org.springframework.boot.autoconfigure.jackson.JacksonProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.546Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$ParameterNamesModuleConfiguration' of type [org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$ParameterNamesModuleConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.547Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'parameterNamesModule' of type [com.fasterxml.jackson.module.paramnames.ParameterNamesModule] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.548Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonMixinConfiguration' of type [org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonMixinConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.555Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'jsonMixinModuleEntries' of type [org.springframework.boot.jackson.JsonMixinModuleEntries] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.556Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'jsonMixinModule' of type [org.springframework.boot.jackson.JsonMixinModule] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.556Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration' of type [org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.578Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'jsonComponentModule' of type [org.springframework.boot.jackson.JsonComponentModule] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.578Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'standardJacksonObjectMapperBuilderCustomizer' of type [org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration$StandardJackson2ObjectMapperBuilderCustomizer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.580Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'jacksonObjectMapperBuilder' of type [org.springframework.http.converter.json.Jackson2ObjectMapperBuilder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.587Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'jacksonObjectMapper' of type [com.fasterxml.jackson.databind.ObjectMapper] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.588Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'jacksonCodecCustomizer' of type [org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$JacksonCodecConfiguration$$Lambda/0x00000001204093a8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.589Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'exchangeStrategiesCustomizer' of type [org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientCodecCustomizer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.589Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.actuate.autoconfigure.observation.web.client.WebClientObservationConfiguration' of type [org.springframework.boot.actuate.autoconfigure.observation.web.client.WebClientObservationConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.590Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration' of type [org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.591Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'observationRegistry' of type [io.micrometer.observation.SimpleObservationRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.593Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'management.observations-org.springframework.boot.actuate.autoconfigure.observation.ObservationProperties' of type [org.springframework.boot.actuate.autoconfigure.observation.ObservationProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.595Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'management.metrics-org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties' of type [org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.603Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'observationWebClientCustomizer' of type [org.springframework.boot.actuate.metrics.web.reactive.client.ObservationWebClientCustomizer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.607Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'webClientBuilder' of type [org.springframework.web.reactive.function.client.DefaultWebClientBuilder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [methodValidationPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2024-02-05T08:07:11.607Z  WARN 97603 --- [           main] [                                                 ] trationDelegate$BeanPostProcessorChecker : Bean 'appConfig' of type [dev.dflachbart.sampleservice.config.AppConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [methodValidationPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead.

When methodValidationPostProcessor is non-static, an instance of AppConfig needs to be created before the post-processor can be created. This in turn requires injection and therefore creation of the WebClient.Builder. This very early creation of the builder prevents it from being post-processed and prevents the observation support from being added to the WebClient that it creates.

Comment From: dflachbart

Andy, thanks for the explanation, totally missed this. Guess I should better pay more attention to the warnings that Spring Boot spits out