beginnerWhy Spring & Spring Boot

What does 'auto-configuration' actually do under the hood in Spring Boot?

At startup, Spring Boot scans `META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports` for a list of `@Configuration` classes, each guarded by conditional annotations like `@ConditionalOnClass` or `@ConditionalOnMissingBean`. It only activates a configuration if its trigger condition is true (e.g. an embedded Tomcat bean is only created if `spring-boot-starter-web` is on the classpath and you haven't already defined your own server bean), which is why adding a starter dependency is often the only setup step needed.

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 is constructor injection preferred over field injection in modern Spring code?← Back to all Spring Boot questions