/**
* 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.
* ImportSelector的子类应该基于给定的选择规则来判定什么样的配置类应该被导入
* 这样规则通常是一个或多个注解属性
*
* <p>An {@link org.springframework.context.annotation.ImportSelector} may implement any of the following
* {@link org.springframework.beans.factory.Aware Aware} interfaces,
* and their respective methods will be called prior to {@link #selectImports}:
* 任何ImportSelector的实现类都可以实现以下接口
* 并且他们相应的方法会优先于selectImports被调用
* <ul>
* <li>{@link org.springframework.context.EnvironmentAware EnvironmentAware}</li>
* <li>{@link org.springframework.beans.factory.BeanFactoryAware BeanFactoryAware}</li>
* <li>{@link org.springframework.beans.factory.BeanClassLoaderAware BeanClassLoaderAware}</li>
* <li>{@link org.springframework.context.ResourceLoaderAware ResourceLoaderAware}</li>
* </ul>
*
*
* <p>{@code ImportSelector} implementations are usually processed in the same way
* as regular {@code @Import} annotations, however, it is also possible to defer
* selection of imports until all {@code @Configuration} classes have been processed
* (see {@link DeferredImportSelector} for details).
*
* Spring对ImportSelector的处理方式和普通的@Import注解的处理方式是一样的,
* 但是ImportSelector可以在选择如何导入配置类上做差异化处理
*
* @author Chris Beams
* @since 3.1
* @see DeferredImportSelector
* @see Import
* @see ImportBeanDefinitionRegistrar
* @see Configuration
*/
public interface ImportSelector {
/**
* Select and return the names of which class(es) should be imported based on
* the {@link AnnotationMetadata} of the importing @{@link Configuration} class.
*
* 根据导入的配置类注的注释元数据来选择需要导入的配置类并返回配置类的类名
*/
String[] selectImports(AnnotationMetadata importingClassMetadata);
}
网友评论