@SpringBootConfiguration @EnableAutoConfiguration @ComponentScan( excludeFilters = {@Filter( type = FilterType.CUSTOM, classes = {TypeExcludeFilter.class} ), @Filter( type = FilterType.CUSTOM, classes = {AutoConfigurationExcludeFilter.class} )} )
ssdss@SpringBootApplication = @SpringBootConfiguration➕@ComponentScan➕@EnableAutoConfiguration
s ddsss1. @SpringBootConfiguration :代表当前是一个配置类
s ddsss2. @ComponentScan :指定扫描哪些,参考Spring注解
s ddsss3. @EnableAutoConfiguration = @AutoConfigurationPackage ➕ @Import(重点)
@AutoConfigurationPackage @Import({AutoConfigurationImportSelector.class}) public @interface EnableAutoConfiguration { String ENABLED_OVERRIDE_PROPERTY = "spring.boot.enableautoconfiguration"; Class<?>[] exclude() default {}; String[] excludeName() default {}; }
sdssdss作用:制定了默认包规则并自动配置包
@Import({Registrar.class}) ❤