5. 启动引导:SpringBoot的核心-自动装配(二)
【接前章】
6. SpringBoot的自动装配
6.2 @Import(AutoConfigurationImportSelector.class)
根据上一章节的基础,看到这个也不难理解,它导入了一个 ImportSelector
,来向容器中导入组件。
导入的组件是:AutoConfigurationImportSelector
6.2.1 AutoConfigurationImportSelector
public class AutoConfigurationImportSelector implements DeferredImportSelector, BeanClassLoaderAware,
ResourceLoaderAware, BeanFactoryAware, EnvironmentAware, Ordered
文档注释原文翻译:
DeferredImportSelector
to handle auto-configuration. This class can also be subclassed if a custom variant of @EnableAutoConfiguration
is needed.
DeferredImportSelector
处理自动配置。如果需要自定义扩展 @EnableAutoConfiguration
,则也可以编写该类的子类。
咱能看出来它是 ImportSelector
, 可它又特别提到了 DeferredI