The full picture
🎬 How auto-configuration decides
1 / 5@SpringBootApplication = @Configuration + @ComponentScan + @EnableAutoConfiguration. The last one is where the magic starts.
- Condition vocabulary:
@ConditionalOnClass(starter jar present?),@ConditionalOnMissingBean(did the user define one?),@ConditionalOnProperty(feature toggles),@ConditionalOnWebApplication, plus ordering (@AutoConfiguration(after = …)) so e.g. JPA config sees the DataSource config's output. - Properties bind the details: the auto-config creates the bean;
spring.datasource.*/server.*etc. configure it via@ConfigurationProperties— the reason 'change a property' usually replaces 'write a bean'. - Debugging: run with
--debugfor the Condition Evaluation Report (matched/unmatched with reasons), or the actuatorconditionsendpoint. Knowing this exists is the difference between 'Boot is magic' and 'Boot is inspectable'. - Evaluation order caveat: user
@Configurationparses before auto-config, which is what makes back-off deterministic. But@ConditionalOnBeanbetween your own regular configs is unreliable — condition evaluation order among them isn't defined.