I don't understand how the SpringBootApplication shortcut works. Specifically I don't understand how the individual sub annotations like @ComponentScan and @EnableAutoConfiguration get passed onto the actual application class as if they were written explicitly there. I searched spring boot's code base for SpringBootApplication expecting to see code that looks for the "SpringBootApplication" string before applying these individual annotations but did not see any. Can someone explain this? Thanks.
The @SpringBootApplication
annotation is an annotation that is annotated with, among others, the annotations @ComponentScan
and @EnableAutoConfiguration
you mentioned. Instead of scanning for @SpringBootApplication
, Spring internally scans for these (implicit) annotations and does its magic accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With