Card 02/ 06

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.

text
SpringBootConfiguration
EnableAutoConfiguration
ComponentScan
SpringBootApplication.class.getAnnotations(), read by reflection — verified
What each one does
AnnotationJob
@SpringBootConfigurationMarks the class as a source of bean definitions — a specialised @Configuration
@EnableAutoConfigurationTurns on the classpath-scanning mechanism that creates beans for you
@ComponentScanFinds 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.