Hard java spring

1. How does Spring Boot decide which auto-configuration to apply?

Sample answer: "Boot reads a list of candidate auto-configuration classes from META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports in each jar. Each class has conditions, most often @ConditionalOnClass and @ConditionalOnMissingBean. So it applies only when the needed classes are on the classpath and I haven't defined my own bean. My beans always win."

Follow-up: How do you see what was applied? (Run with --debug to get the conditions report.)

Sources (2)
  1. Creating your own auto-configuration: Locating candidates and Condition annotations
  2. Using auto-configuration