Class AutoConfigurationImportSelector
java.lang.Object
org.springframework.boot.autoconfigure.AutoConfigurationImportSelector
- All Implemented Interfaces:
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 handle auto-configuration. This class can also be subclassed if a custom variant of
@EnableAutoConfiguration is needed.- Since:
- 1.3.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classNested classes/interfaces inherited from interface org.springframework.context.annotation.DeferredImportSelector
org.springframework.context.annotation.DeferredImportSelector.Group -
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?> Return the source annotation class used by the selector.protected @Nullable org.springframework.core.annotation.AnnotationAttributesgetAttributes(org.springframework.core.type.AnnotationMetadata metadata) Return the appropriateAnnotationAttributesfrom theAnnotationMetadata.getAutoConfigurationEntry(org.springframework.core.type.AnnotationMetadata annotationMetadata) Return theAutoConfigurationImportSelector.AutoConfigurationEntrybased on theAnnotationMetadataof the importing@Configurationclass.protected List<AutoConfigurationImportFilter> protected List<AutoConfigurationImportListener> protected ClassLoaderprotected final org.springframework.beans.factory.config.ConfigurableListableBeanFactorygetCandidateConfigurations(org.springframework.core.type.AnnotationMetadata metadata, @Nullable org.springframework.core.annotation.AnnotationAttributes attributes) Return the auto-configuration class names that should be considered.protected final org.springframework.core.env.EnvironmentReturns the auto-configurations excluded by thespring.autoconfigure.excludeproperty.getExclusions(org.springframework.core.type.AnnotationMetadata metadata, @Nullable org.springframework.core.annotation.AnnotationAttributes attributes) Return any exclusions that limit the candidate configurations.Class<? extends org.springframework.context.annotation.DeferredImportSelector.Group> intgetOrder()protected final org.springframework.core.io.ResourceLoaderprotected voidhandleInvalidExcludes(List<String> invalidExcludes) Handle any invalid excludes that have been specified.protected booleanisEnabled(org.springframework.core.type.AnnotationMetadata metadata) protected final <T> List<T> removeDuplicates(List<T> list) String[]selectImports(org.springframework.core.type.AnnotationMetadata annotationMetadata) voidsetBeanClassLoader(ClassLoader classLoader) voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) voidsetEnvironment(org.springframework.core.env.Environment environment) voidsetResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
-
Constructor Details
-
AutoConfigurationImportSelector
public AutoConfigurationImportSelector()
-
-
Method Details
-
selectImports
- Specified by:
selectImportsin interfaceorg.springframework.context.annotation.ImportSelector
-
getExclusionFilter
-
getAutoConfigurationEntry
protected AutoConfigurationImportSelector.AutoConfigurationEntry getAutoConfigurationEntry(org.springframework.core.type.AnnotationMetadata annotationMetadata) Return theAutoConfigurationImportSelector.AutoConfigurationEntrybased on theAnnotationMetadataof the importing@Configurationclass.- Parameters:
annotationMetadata- the annotation metadata of the configuration class- Returns:
- the auto-configurations that should be imported
-
getImportGroup
public Class<? extends org.springframework.context.annotation.DeferredImportSelector.Group> getImportGroup()- Specified by:
getImportGroupin interfaceorg.springframework.context.annotation.DeferredImportSelector
-
isEnabled
protected boolean isEnabled(org.springframework.core.type.AnnotationMetadata metadata) -
getAttributes
protected @Nullable org.springframework.core.annotation.AnnotationAttributes getAttributes(org.springframework.core.type.AnnotationMetadata metadata) Return the appropriateAnnotationAttributesfrom theAnnotationMetadata. By default this method will return attributes forgetAnnotationClass().- Parameters:
metadata- the annotation metadata- Returns:
- annotation attributes
-
getAnnotationClass
Return the source annotation class used by the selector.- Returns:
- the annotation class
-
getCandidateConfigurations
protected List<String> getCandidateConfigurations(org.springframework.core.type.AnnotationMetadata metadata, @Nullable org.springframework.core.annotation.AnnotationAttributes attributes) Return the auto-configuration class names that should be considered. By default, this method will load candidates usingImportCandidates.- Parameters:
metadata- the source metadataattributes- theannotation attributes- Returns:
- a list of candidate configurations
-
handleInvalidExcludes
-
getExclusions
protected Set<String> getExclusions(org.springframework.core.type.AnnotationMetadata metadata, @Nullable org.springframework.core.annotation.AnnotationAttributes attributes) Return any exclusions that limit the candidate configurations.- Parameters:
metadata- the source metadataattributes- theannotation attributes- Returns:
- exclusions or an empty set
-
getExcludeAutoConfigurationsProperty
-
getAutoConfigurationImportFilters
-
removeDuplicates
-
asList
-
getAutoConfigurationImportListeners
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Throws:
org.springframework.beans.BeansException
-
getBeanFactory
protected final org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory() -
setBeanClassLoader
- Specified by:
setBeanClassLoaderin interfaceorg.springframework.beans.factory.BeanClassLoaderAware
-
getBeanClassLoader
-
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) - Specified by:
setEnvironmentin interfaceorg.springframework.context.EnvironmentAware
-
getEnvironment
protected final org.springframework.core.env.Environment getEnvironment() -
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) - Specified by:
setResourceLoaderin interfaceorg.springframework.context.ResourceLoaderAware
-
getResourceLoader
protected final org.springframework.core.io.ResourceLoader getResourceLoader() -
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-