SpringBoot注解

SpringBootApplication注解源码如下:

@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) })
public @interface SpringBootApplication {
}

@SpringBootApplication:SpringBoot的主入口
@SpringBootConfiguration:表示Application作为配置文件存在
@EnableAutoConfiguration:表示启用SpringBoot内置的自动配置功能
@ComponentScan : 扫描bean,路径为Application类所在package以及package下的子路径,在spring boot中bean都放置在该路径以及子路径下。

你可能感兴趣的:(SpringBoot注解)