自己怎么做商城网站视频教程,杭州智能模板建站,wordpress采集 知乎,小程序设计与开发1、自动配置类读取原理
SpringBootApplication应用标注在某个类上#xff0c;说明这个类是SpringBoot的主配置类#xff0c;SpringBoot的项目需要运行这个类的main方法来启动SpringBoot应用的服务#xff1b;
1.1 源码分析
Target(ElementType.TYPE)
Retention(Retention…1、自动配置类读取原理
SpringBootApplication应用标注在某个类上说明这个类是SpringBoot的主配置类SpringBoot的项目需要运行这个类的main方法来启动SpringBoot应用的服务
1.1 源码分析
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 {}SpringBootConfiguration用于标识这个类是SpringBoot的配置类EnableAutoConfiguration开启自动配置的功能,会自动扫描所有自动配置类扫描到且满足条件才会生效。ComponentScan包扫描 TypeExcludeFilterSpringBoot对外提供的扩展类 可以去按照我们的方式进行排除AutoConfigurationExcludeFilter排除所有配置类并且是自动配置类
Target(ElementType.TYPE)
Retention(RetentionPolicy.RUNTIME)
Documented
Inherited
AutoConfigurationPackage
Import(AutoConfigurationImportSelector.class)
public interface EnableAutoConfiguration {}AutoConfigurationPackage将当前配置类所在包保存在BasePackages的Bean中。供Spring内部使用。自动装配流程图
后续深入更新…