I wanted to add some metrics provided by Lettuce for monitoring purpose of connections to Redis. But when injecting MeterRegistry in our Configuration class, MeterRegistryProcessor is no longer called, hence MeterRegistry is not configured.

Similar issue has been reported here https://github.com/spring-projects/spring-boot/issues/18565, but only a fix for Spring Cloud Sleuth use case has been done.

I've built a minimal sample application to reproduce issue: https://github.com/Nik95/sample-spring-boot

Comment From: snicoll

Thanks for the sample.

Running it leads to the following:

2021-12-15 15:14:05.681  INFO 67962 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration' of type [org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-15 15:14:05.698  INFO 67962 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'management.metrics.export.simple-org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleProperties' of type [org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-15 15:14:05.701  INFO 67962 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'simpleConfig' of type [org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimplePropertiesConfigAdapter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-15 15:14:05.704  INFO 67962 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration' of type [org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-15 15:14:05.705  INFO 67962 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'micrometerClock' of type [io.micrometer.core.instrument.Clock$1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-15 15:14:05.726  INFO 67962 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'simpleMeterRegistry' of type [io.micrometer.core.instrument.simple.SimpleMeterRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-15 15:14:05.728  INFO 67962 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'cacheConfiguration' of type [org.example.CacheConfiguration$$EnhancerBySpringCGLIB$$5d2571d3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

This is due to early initialization of CachingConfigurer that was fixed today and will be available with the next release. I've updated your sample app to 2.6.2-SNAPSHOT and this went away.

A couple of remarks about the sample: there's no need to provide a version for Spring Data Redis or Lettuce, and using field autowiring on the MeterRegistry isn't great regardless as it forces the container to resolve that very early. A much better approach for this would be a customization using ClientResourcesBuilderCustomizer. That's actually what Spring Boot does out of the box.

Comment From: Nik95

Thanks @snicoll for the fix.

Regarding your remarks, it is just because I copy/paste code from our actual prod application that use an older Spring / Spring boot version.

Comment From: frenchcsurest

I think there might be a regression, I have a class that uses implements CachingConfigurer and throws the error: WARN o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker Bean of type 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 [meterRegistryPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies. Using springframework 6.1.13

Comment From: bclozel

@frenchcsurest we are not aware of any regression there. Can you craft a minimal sample application and create a new issue please?