advancedSpring Boot Internals

How does Spring Boot auto-configuration work internally (@EnableAutoConfiguration)?

@EnableAutoConfiguration (bundled inside @SpringBootApplication) triggers Spring to read META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports — a list of candidate auto-configuration classes each starter ships. Every candidate is guarded by @Conditional annotations (@ConditionalOnClass, @ConditionalOnMissingBean, @ConditionalOnProperty), so only the configurations whose conditions actually match your classpath and existing beans get activated — which is also exactly why defining your own bean of the same type silently overrides the auto-configured one.

This is a Pro question

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

How does Spring Boot auto-configuration work internally (@EnableAutoConfiguration)?

Next Step

Continue to What is Spring Boot and how is it different from the Spring Framework?← Back to all Spring Boot & Microservices questions