springboot annotation (1) @SpringBootApplication

Anyone who has used springboot knows that the @SpringBootApplication annotation is placed on the startup class. Let me briefly talk about this annotation now.

This annotation is a compound annotation. Through the source code, we can find that it contains three annotations.

@SpringBootConfiguration configuration class annotation, the same as @Configuration annotation. At the same time, it means that the startup class is also a configuration class, which can use the @Bean annotation to delegate some beans to the spring container management.

@EnableAutoConfiguration automatic assembly annotation

@ComponentScan component scanning annotation can only scan beans under the package and sub-packages of the startup class.

Guess you like

Origin blog.csdn.net/dhklsl/article/details/114983606