SpringBootApplication

What

@SpringBootApplication注释用于标记一个类为配置类,其可以声明一个或多个@Bean方法, 同时触发自动装配@EnableAutoConfiguration组件扫描@ComponentScan

这是一个方便使用的注释(@Annotation),相当于同时声明了@Configuration@EnableAutoConfiguration@ComponentScan注释。

Definition

package org.springframework.boot.autoconfigure;

@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 {

}