深入理解Spring的ImportSelector接口
ImportSelector接口是至spring中导入外部配置的核心接口,在SpringBoot的自动化配置和@EnableXXX(功能性注解)都有它的存在,关于SpringBoot的分析可以参考: 深入理解SpringBoot的自动装配 。 一、关于ImportSelector接口 package org.springframework.context.annotation; import org.springframework.core.type.AnnotationMetadata; /** * Interface to be implemented by types that determine which @{ @link Configuration} * class(es) should be imported based on a given selection criteria, usually one or more * annotation attributes. * * <p>An { @link ImportSelector} may implement any of the following * { @link org.springframework.beans.factory.Aware Aware} interfaces, and their