advancedSpring Internals — Bean Lifecycle & Proxies

What happens when two auto-configurations define the same bean with conflicting conditions?

Spring Boot evaluates auto-configuration classes in a defined order (via @AutoConfigureBefore/@AutoConfigureAfter and @ConditionalOnMissingBean); the first one whose conditions pass typically wins, and later ones back off. Running with --debug shows the exact Conditions Evaluation Report explaining which configuration was applied and why.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why can overriding an auto-configured bean unintentionally disable metrics, tracing, or health checks?← Back to all Spring Boot & Microservices questions