@SpringBootApplication //是SpringBoot的配置类 public class SpringbootVueApplication { public static void main(String[] args) { SpringApplication.run(SpringbootVueApplication.class, args); } }
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 {
@EnableAutoConfiguration:开启自动配置功能
@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @AutoConfigurationPackage @Import(AutoConfigurationImportSelector.class) public @interface EnableAutoConfiguration {
@AutoConfigurationPackage:自动配置包,将主配置类(@SpringBootApplication )所在的包以及所有的自保里面的组件放在容器中,自动匹配值类就生效,帮我们进行自动配置工作。
J2EE的整体整合方案和自动配置都在