Class AutoConfigurationImportSelector
java.lang.Object
org.springframework.boot.autoconfigure.AutoConfigurationImportSelector
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,DeferredImportSelector,ImportSelector,EnvironmentAware,ResourceLoaderAware,Ordered
public class AutoConfigurationImportSelector
extends Object
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.- Since:
- 1.3.0
- Author:
- Phillip Webb, Andy Wilkinson, Stephane Nicoll, Madhura Bhave, Moritz Halbritter, Scott Frederick
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classNested classes/interfaces inherited from interface org.springframework.context.annotation.DeferredImportSelector
DeferredImportSelector.Group -
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasList(AnnotationAttributes attributes, String name) protected Class<?>Return the source annotation class used by the selector.protected AnnotationAttributesgetAttributes(AnnotationMetadata metadata) Return the appropriateAnnotationAttributesfrom theAnnotationMetadata.getAutoConfigurationEntry(AnnotationMetadata annotationMetadata) Return theAutoConfigurationImportSelector.AutoConfigurationEntrybased on theAnnotationMetadataof the importing@Configurationclass.protected List<AutoConfigurationImportFilter>protected List<AutoConfigurationImportListener>protected ClassLoaderprotected final ConfigurableListableBeanFactorygetCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) Return the auto-configuration class names that should be considered.protected final EnvironmentReturns the auto-configurations excluded by thespring.autoconfigure.excludeproperty.getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes) Return any exclusions that limit the candidate configurations.Class<? extends DeferredImportSelector.Group>intgetOrder()protected final ResourceLoaderprotected voidhandleInvalidExcludes(List<String> invalidExcludes) Handle any invalid excludes that have been specified.protected booleanisEnabled(AnnotationMetadata metadata) protected final <T> List<T>removeDuplicates(List<T> list) String[]selectImports(AnnotationMetadata annotationMetadata) voidsetBeanClassLoader(ClassLoader classLoader) voidsetBeanFactory(BeanFactory beanFactory) voidsetEnvironment(Environment environment) voidsetResourceLoader(ResourceLoader resourceLoader)
-
Constructor Details
-
AutoConfigurationImportSelector
public AutoConfigurationImportSelector()
-
-
Method Details
-
selectImports
- Specified by:
selectImportsin interfaceImportSelector
-
getExclusionFilter
- Specified by:
getExclusionFilterin interfaceImportSelector
-
getAutoConfigurationEntry
protected AutoConfigurationImportSelector.AutoConfigurationEntry getAutoConfigurationEntry(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
- Specified by:
getImportGroupin interfaceDeferredImportSelector
-
isEnabled
-
getAttributes
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(AnnotationMetadata metadata, 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
Handle any invalid excludes that have been specified.- Parameters:
invalidExcludes- the list of invalid excludes (will always have at least one element)
-
getExclusions
Return any exclusions that limit the candidate configurations.- Parameters:
metadata- the source metadataattributes- theannotation attributes- Returns:
- exclusions or an empty set
-
getExcludeAutoConfigurationsProperty
Returns the auto-configurations excluded by thespring.autoconfigure.excludeproperty.- Returns:
- excluded auto-configurations
- Since:
- 2.3.2
-
getAutoConfigurationImportFilters
-
removeDuplicates
-
asList
-
getAutoConfigurationImportListeners
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Throws:
BeansException
-
getBeanFactory
-
setBeanClassLoader
- Specified by:
setBeanClassLoaderin interfaceBeanClassLoaderAware
-
getBeanClassLoader
-
setEnvironment
- Specified by:
setEnvironmentin interfaceEnvironmentAware
-
getEnvironment
-
setResourceLoader
- Specified by:
setResourceLoaderin interfaceResourceLoaderAware
-
getResourceLoader
-
getOrder
public int getOrder()
-