Card 02/ 06
All 6 cards
ConceptDifficulty: Intermediate1 min
The Three Annotations Inside @SpringBootApplication
@SpringBootApplication is not one mechanism. It is three, combined into a single annotation so a new project starts with one line instead of three.
SpringBootConfiguration
EnableAutoConfiguration
ComponentScan| Annotation | Job |
|---|---|
@SpringBootConfiguration | Marks the class as a source of bean definitions — a specialised @Configuration |
@EnableAutoConfiguration | Turns on the classpath-scanning mechanism that creates beans for you |
@ComponentScan | Finds your own @Component-family classes, starting from this class's package |
@EnableAutoConfiguration is the one that's actually new here — @Configuration and @ComponentScan both exist in plain Spring already. It's what the next two cards are about.