mediumConceptScenarioMidSeniorStaff
How does Spring Boot auto-configuration decide what to create, and how do you override it?
Spring Boot auto-configuration loads candidate classes from AutoConfiguration.imports, applies conditional annotations, and backs off when your own beans or properties already define the needed behavior.
5 min readUpdated 2026-08-15
Answer
Short answer
Spring Boot auto-configuration imports candidate configuration classes, then creates beans only when their conditions match. Override it by defining your own bean, changing the relevant property, excluding an auto-configuration, or writing a starter with explicit conditions and ordering.
Keep spring boot explicit in the answer because that is the concept the interviewer is actually trying to test.
Was this answer helpful?
Likely follow-ups
- What is in the condition evaluation report, and how do you get it out of a running app?
- Why did spring.factories stop being the mechanism for declaring auto-configurations?
- How do liveness and readiness health groups differ, and what should each one check?
- How would you write an auto-configuration for an internal starter, and what would you put in @AutoConfigureAfter?
Related questions
- Security review asks which Actuator endpoints are exposed in production. What do you expose, to whom, and which one quietly leaks secrets?mediumAlso on actuator and spring-boot4 min
- Your Spring Boot service needs 50 seconds to start and Kubernetes keeps killing it before it is ready. What do you change, and in which order?mediumAlso on spring-boot and actuator4 min
- A property has one value in application.yml, another in production, and nobody can say where the production value comes from. How do you find out?mediumAlso on spring-boot and actuator4 min
- Why would you bind configuration with @ConfigurationProperties rather than @Value, and how do you make a bad value fail at startup instead of at the first request?mediumAlso on spring-boot and configuration-properties4 min