@SpringBootApplication:springboot启动类上唯一的一个注解,它是一个组合注解。

@SpringBootConfiguration:表明该类为配置类

@EnableAutoConfiguration :启动自动配置功能

@AutoConfigurationPackage:自动配置包

【@SpringBootApplication的Spring Boot应用程序入口类所在的包】

 registry方法:

@Import(AutoConfigurationImportSelector.class):向容器中导入一个组件

AutoConfigurationImportSelector类:

自动配置主要方法:getAutoConfigurationEntry();

通过该方法加载并注册了spring.factories中的所有生效的自动配置类倒到spring容器中

@ComponentScan:用于注解扫描

当ComponentScan注解没有标注basePackages以及value时,扫描路径默认为ComponentScan的类所在的包

 

更多推荐

springboot常用注解的作用【详解】