What does @SpringBootApplication consist of? How is a starter different from auto-configuration?
Short answer
@SpringBootApplication combines @SpringBootConfiguration, @EnableAutoConfiguration and @ComponentScan. A starter just brings in compatible libraries; auto-configuration decides which beans to create based on the classpath.
3 points to say:
@SpringBootApplication= configuration + auto-config + component scan.- The starter brings libraries, auto-config creates beans; switch Tomcat to Jetty by swapping the starter.
- A misplaced
mainclass is the most common "bean not found" cause, since scanning goes only from its package downward.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.