advancedSpring Internals — Bean Lifecycle & Proxies

Why can overriding an auto-configured bean unintentionally disable metrics, tracing, or health checks?

Many auto-configured beans (like a DataSource or RestTemplate) are automatically wrapped or instrumented by other auto-configurations (Micrometer metrics, tracing). Defining your own bean of the same type can suppress the @ConditionalOnMissingBean-guarded instrumentation that would have wrapped Spring Boot's default.

This is a Pro question

Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.

Why can overriding an auto-configured bean unintentionally disable metrics, tracing, or health checks?

Next Step

Continue to How do ApplicationContextInitializer, BeanFactoryPostProcessor, and BeanPostProcessor execute during the Spring lifecycle?← Back to all Spring Boot & Microservices questions