You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the newly introduced RepositoryMetricsAutoConfiguration (Spring Boot 2.5.0) triggers the creation of the MeterRegistry bean during the initialization of the bean post processor. This leaves no chance for MeterRegistryPostProcessor#postProcessAfterInitialization to customize the registry with MeterRegistryCustomizer.
The call stack shows some registerBeanPostProcessors when the registry is instanciated which is not the case when RepositoryMetricsAutoConfiguration is not loaded.
If you run it, you can see that MetricsCustomizerNotCalledApplication#meterRegistryCustomizer is never called. If spring-boot-starter-data-jpa is removed from dependencies, it is called as expected.
A ugly workaround would be to call it again afterwards with something like:
Hello!
It seems that the newly introduced
RepositoryMetricsAutoConfiguration
(Spring Boot 2.5.0) triggers the creation of theMeterRegistry
bean during the initialization of the bean post processor. This leaves no chance forMeterRegistryPostProcessor#postProcessAfterInitialization
to customize the registry withMeterRegistryCustomizer
.The call stack shows some
registerBeanPostProcessors
when the registry is instanciated which is not the case whenRepositoryMetricsAutoConfiguration
is not loaded.I created a minimal sample repo to reproduce the issue.
If you run it, you can see that
MetricsCustomizerNotCalledApplication#meterRegistryCustomizer
is never called. Ifspring-boot-starter-data-jpa
is removed from dependencies, it is called as expected.A ugly workaround would be to call it again afterwards with something like:
Thanks for your help.
The text was updated successfully, but these errors were encountered: