Skip to content
Preptima
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

Further reading

Related Topics