1. @SpringBootApplication中包含一个叫@EnableAutoConfiguration的注解
这个注解就是实现自动装配的核心注解
@EnableAutoConfiguration中使用@Import导入了AutoConfigurationImportSelector类
此类是实现自动装配的核心类
getCandidateConfigurations方法里面的SpringFactoriesLoader.loadFactoryNames来读取spring-boot-autoconfigure包里的META-INF/spring.factories文件,通过获取类的全限定名并调用java.lang.ClassLoader加载自动装配的类
spring-boot-autoconfigure包中已写好了各种组件的自动装配类,只需要在使用的时候引入相关组件的包,然后在application.yml中配置即可使用。