类 AutoConfigurationImportSelector
- java.lang.Object
- org.springframework.boot.autoconfigure.AutoConfigurationImportSelector
- 所有已实现的接口:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.context.annotation.DeferredImportSelector
,org.springframework.context.annotation.ImportSelector
,org.springframework.context.EnvironmentAware
,org.springframework.context.ResourceLoaderAware
,org.springframework.core.Ordered
public class AutoConfigurationImportSelector extends Object implements org.springframework.context.annotation.DeferredImportSelector, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.EnvironmentAware, org.springframework.core.Ordered
DeferredImportSelector
to handleauto-configuration
. This class can also be subclassed if a custom variant of@EnableAutoConfiguration
is needed.- 从以下版本开始:
- 1.3.0
- 另请参阅:
EnableAutoConfiguration
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static class
AutoConfigurationImportSelector.AutoConfigurationEntry
构造器概要
构造器 构造器 说明 AutoConfigurationImportSelector()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected List<String>
asList(org.springframework.core.annotation.AnnotationAttributes attributes, String name)
protected Class<?>
getAnnotationClass()
Return the source annotation class used by the selector.protected org.springframework.core.annotation.AnnotationAttributes
getAttributes(org.springframework.core.type.AnnotationMetadata metadata)
Return the appropriateAnnotationAttributes
from theAnnotationMetadata
.protected AutoConfigurationImportSelector.AutoConfigurationEntry
getAutoConfigurationEntry(AutoConfigurationMetadata autoConfigurationMetadata, org.springframework.core.type.AnnotationMetadata annotationMetadata)
Return theAutoConfigurationImportSelector.AutoConfigurationEntry
based on theAnnotationMetadata
of the importing@Configuration
class.protected List<AutoConfigurationImportFilter>
getAutoConfigurationImportFilters()
protected List<AutoConfigurationImportListener>
getAutoConfigurationImportListeners()
protected ClassLoader
getBeanClassLoader()
protected org.springframework.beans.factory.config.ConfigurableListableBeanFactory
getBeanFactory()
protected List<String>
getCandidateConfigurations(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.core.annotation.AnnotationAttributes attributes)
Return the auto-configuration class names that should be considered.protected org.springframework.core.env.Environment
getEnvironment()
protected Set<String>
getExclusions(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.core.annotation.AnnotationAttributes attributes)
Return any exclusions that limit the candidate configurations.Class<? extends org.springframework.context.annotation.DeferredImportSelector.Group>
getImportGroup()
int
getOrder()
protected org.springframework.core.io.ResourceLoader
getResourceLoader()
protected Class<?>
getSpringFactoriesLoaderFactoryClass()
Return the class used bySpringFactoriesLoader
to load configuration candidates.protected void
handleInvalidExcludes(List<String> invalidExcludes)
Handle any invalid excludes that have been specified.protected boolean
isEnabled(org.springframework.core.type.AnnotationMetadata metadata)
protected <T> List<T>
removeDuplicates(List<T> list)
String[]
selectImports(org.springframework.core.type.AnnotationMetadata annotationMetadata)
void
setBeanClassLoader(ClassLoader classLoader)
void
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
void
setEnvironment(org.springframework.core.env.Environment environment)
void
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
构造器详细资料
AutoConfigurationImportSelector
public AutoConfigurationImportSelector()
方法详细资料
selectImports
public String[] selectImports(org.springframework.core.type.AnnotationMetadata annotationMetadata)
- 指定者:
selectImports
在接口中org.springframework.context.annotation.ImportSelector
getAutoConfigurationEntry
protected AutoConfigurationImportSelector.AutoConfigurationEntry getAutoConfigurationEntry(AutoConfigurationMetadata autoConfigurationMetadata, org.springframework.core.type.AnnotationMetadata annotationMetadata)
Return theAutoConfigurationImportSelector.AutoConfigurationEntry
based on theAnnotationMetadata
of the importing@Configuration
class.- 参数:
autoConfigurationMetadata
- the auto-configuration metadataannotationMetadata
- the annotation metadata of the configuration class- 返回:
- the auto-configurations that should be imported
getImportGroup
public Class<? extends org.springframework.context.annotation.DeferredImportSelector.Group> getImportGroup()
- 指定者:
getImportGroup
在接口中org.springframework.context.annotation.DeferredImportSelector
isEnabled
protected boolean isEnabled(org.springframework.core.type.AnnotationMetadata metadata)
getAttributes
protected org.springframework.core.annotation.AnnotationAttributes getAttributes(org.springframework.core.type.AnnotationMetadata metadata)
Return the appropriateAnnotationAttributes
from theAnnotationMetadata
. By default this method will return attributes forgetAnnotationClass()
.- 参数:
metadata
- the annotation metadata- 返回:
- annotation attributes
getAnnotationClass
protected Class<?> getAnnotationClass()
Return the source annotation class used by the selector.- 返回:
- the annotation class
getCandidateConfigurations
protected List<String> getCandidateConfigurations(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.core.annotation.AnnotationAttributes attributes)
Return the auto-configuration class names that should be considered. By default this method will load candidates usingSpringFactoriesLoader
withgetSpringFactoriesLoaderFactoryClass()
.- 参数:
metadata
- the source metadataattributes
- theannotation attributes
- 返回:
- a list of candidate configurations
getSpringFactoriesLoaderFactoryClass
protected Class<?> getSpringFactoriesLoaderFactoryClass()
Return the class used bySpringFactoriesLoader
to load configuration candidates.- 返回:
- the factory class
handleInvalidExcludes
protected void handleInvalidExcludes(List<String> invalidExcludes)
Handle any invalid excludes that have been specified.- 参数:
invalidExcludes
- the list of invalid excludes (will always have at least one element)
getExclusions
protected Set<String> getExclusions(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.core.annotation.AnnotationAttributes attributes)
Return any exclusions that limit the candidate configurations.- 参数:
metadata
- the source metadataattributes
- theannotation attributes
- 返回:
- exclusions or an empty set
getAutoConfigurationImportFilters
protected List<AutoConfigurationImportFilter> getAutoConfigurationImportFilters()
removeDuplicates
protected final <T> List<T> removeDuplicates(List<T> list)
asList
protected final List<String> asList(org.springframework.core.annotation.AnnotationAttributes attributes, String name)
getAutoConfigurationImportListeners
protected List<AutoConfigurationImportListener> getAutoConfigurationImportListeners()
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
- 指定者:
setBeanFactory
在接口中org.springframework.beans.factory.BeanFactoryAware
- 抛出:
org.springframework.beans.BeansException
getBeanFactory
protected final org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory()
setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)
- 指定者:
setBeanClassLoader
在接口中org.springframework.beans.factory.BeanClassLoaderAware
getBeanClassLoader
protected ClassLoader getBeanClassLoader()
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment)
- 指定者:
setEnvironment
在接口中org.springframework.context.EnvironmentAware
getEnvironment
protected final org.springframework.core.env.Environment getEnvironment()
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
- 指定者:
setResourceLoader
在接口中org.springframework.context.ResourceLoaderAware
getResourceLoader
protected final org.springframework.core.io.ResourceLoader getResourceLoader()
getOrder
public int getOrder()
- 指定者:
getOrder
在接口中org.springframework.core.Ordered