在这个注解中,最重要的是它导入了一个类EnableAutoConfigurationImportSelector
它是一个ImportSelector接口的实现类,而ImportSelector接口中的selectImports方法所返回的类将
被Spring容器管理起来。
再看AutoConfigurationImportSelector类,它不光实现了ImportSelector接口,还实现了很多其它的Aware接口,分别表示在某个时机会被回调,我们看一下Aware接口就知道了。
我们可以知道,所有的aware都优先于selectImports方法执行,也就是说selectImports方法最后执行,那么在它执行的时候所有需要的资源都已经获取到了(就是那四个成员变量)
那我们看看selectImports都干了什么
看图说话:
1、加载META-INF/spring-autoconfigure-metadata.properties文件
2、获取注解的属性及其值(PS:注解指的是@EnableAutoConfiguration注解)
3、在classpath下所有的META-INF/spring.factories文件中查找org.springframework.boot.autoconfigure.EnableAutoConfiguration的值,并将其封装到一个List中返回
4、对上一步返回的List中的元素去重、排序
5、依据第2步中获取的属性值排除一些特定的类
6、对上一步中所得到的List进行过滤,过滤的依据是条件匹配。这里用到的过滤器是org.springframework.boot.autoconfigure.condition.OnClassCondition最终返回的是一个ConditionOutcome[]数组。(PS:很多类都是依赖于其它的类的,当有某个类时才会装配,所以这次过滤的就是根据是否有某个class进而决定是否装配的。这些类所依赖的类都写在META-INF/spring-autoconfigure-metadata.properties文件里)
本文转自 手不要乱摸 51CTO博客,原文链接:http://blog.51cto.com/5880861/1970542
来源:https://yq.aliyun.com/articles/525678
@EnableAutoConfiguration:自动载入应用程序所需的所有Bean,这里涉及的注解有 接下来我们跟着源码一探究竟 点击进入AutoConfigurationImportSelector类 进入getAutoConfigurationEntry方法 进入getCandidateConfigurations 点击进入loadFactoryNames 点击进入当前包下 此时我们选择Re...
springboot踩坑篇-01 springboot踩坑篇-01–@EnableWebMvc注解和@EnableAutoConfiguration 注解 问题出现 最近项目在用springboot开发,项目当中要用到spring的拦截器; import java.util.Date; import javax.servlet.http.HttpServletRequest; impo...
1、@ConfigurationProperties 它的作用是来获取application.yml / application.properties配置的配置项内容,与 添加了该注解的类或方法 的属性进行绑定。 它的生效需要结合@Bean或者 @Component 或者 @EnableConfigurationProperties (1)结合@Bean (2) 结合@Component &nbs...
一、核心注解 @SpringBootApplication:组合注解,包括以**解。 @SpringBootConfiguration: 配置注解,底层其实也是@Configuration注解,只不过在SpringBoot工程中更推荐使用@SpringBootConfiguration来替代Configuration。 @EnableAutoConfiguration: 启动自动配置,根据所依赖的...
文章目录 一、vmstat 1.1 命令说明 1.2 参数说明 1.3 结果说明 二、iostat 2.1 命令说明 2.2 参数说明 2.3 结果说明 三、mpstat 3.1 命令说明 3.2 参数说明 3.3 结果说明 四、netstat 4.1 命令说明 4.2 参数说明 4.3 结果说明 一、vmstat 1.1 命令说明 vmstat可以监控操作系统的进程状态、内存、虚拟内存、磁盘IO...
简介 Construct 2,是一款可用于制作html5游戏的工具软件,由Scirra公司所开发。C2是专门用来制作2D游戏的工具,学会后更可快速制作网页banner、网页广告,让网页具备等同游戏的高互动性。最方便的是,C2支持将html5转成iOS/Android手机APP、或是PC/MAC/Linux上的可执行文件,让你的作品可以在各种平台上流畅的执行。官方安装指南 背景设置 打开Constr...
文章目录 Doppler DPU DopplerProcHWA Windowing FFT and Log2|.| Summation HWA memory bank size limitation Exported APIs Detailed block diagram for 3 TX 4RX DopplerProcDSP Input data Static Clutter Removal W...
Android Audio Architecture 图如下所示 详细调用路径如下 1. 音频播放 示例代码 MediaPlayer mp = new MediaPlayer(); mp.se...
翻译:疯狂的技术宅 原文:https://www.valentinog.com/blog/html-table/ 怎样用原生 JavaScript 生成表格?本文告诉你答案! 这是一个刷 JavaScript 经验值的好机会:在技术面试中出现的最多的一个问题就是怎样用原生 API 操作 DOM。 在下面的教程中,我们将了解如何使用 JavaScript 生成表格,而无需依赖任何库或框架。 你将学到...
参考网址:https://www.cnblogs.com/SPHmomo/p/6913663.html http://lib.csdn.net/article/css3/56228  ...
In the delegate method of UIImagePickerViewController, I want to test for the media type. This worked in Swift 3: But in Swift 4, it throws an error: Expression pattern of type 'CFString' cannot match...
How can I execute but avoid throwing errors if my_table doesn't exist Is it possible? UPDATE: I'm woking in Odoo, I create the table when user presses a button, so for the very first time when my modu...
I am trying to figure out the minimum time elapsed between two columns, grouped by values in a third column ID Start Time End Time 1 2021-08-22 00:00:00 2021-08-24 00:00:00 1 2021-08-21 00:00:00 2021-...
This is the code i am using for creating and inserting nodes in a binary search tree. After that i created recursive inorder function. but this is not giving the right ouput. I am not able to find err...
I faced the same issue as in the following question: Recording midi with Audiokit The problem is pauses in record differs the real pauses. The issue was in source code of the linked question: It has b...