@SpringBootApplication 可分为三个比较重要的注解
分别是:
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan( excludeFilters = {@Filter( type = FilterType.CUSTOM, classes = {TypeExcludeFilter.class} ), @Filter( type = FilterType.CUSTOM, classes = {AutoConfigurationExcludeFilter.class} )} )
前四个为Java常用的元注解,这里不做过多解释
下面依次分析后三个注解的作用
@SpringBootConfiguration
@SpringBootConfiguration注解可以理解为springboot配置类,我们可以简单的点进去看一看里面的内容,第一次点击得到这四个注解,
@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Configuration
前三个为元注解,第四个@Configuration 表明这是一个配置类,点进去有一个@Component注解又可以