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.EnableAutoConfiguration
Modifier and Type | Class and Description |
---|---|
protected static class |
AutoConfigurationImportSelector.AutoConfigurationEntry |
DeferredImportSelector.Group
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
AutoConfigurationImportSelector() |
public String[] selectImports(AnnotationMetadata annotationMetadata)
selectImports
in interface ImportSelector
protected AutoConfigurationImportSelector.AutoConfigurationEntry getAutoConfigurationEntry(AutoConfigurationMetadata autoConfigurationMetadata, AnnotationMetadata annotationMetadata)
AutoConfigurationImportSelector.AutoConfigurationEntry
based on the AnnotationMetadata
of the importing @Configuration
class.autoConfigurationMetadata
- the auto-configuration metadataannotationMetadata
- the annotation metadata of the configuration classpublic Class<? extends DeferredImportSelector.Group> getImportGroup()
getImportGroup
in interface DeferredImportSelector
protected boolean isEnabled(AnnotationMetadata metadata)
protected AnnotationAttributes getAttributes(AnnotationMetadata metadata)
AnnotationAttributes
from the
AnnotationMetadata
. By default this method will return attributes for
getAnnotationClass()
.metadata
- the annotation metadataprotected Class<?> getAnnotationClass()
protected List<String> getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes)
SpringFactoriesLoader
with
getSpringFactoriesLoaderFactoryClass()
.metadata
- the source metadataattributes
- the annotation
attributes
protected Class<?> getSpringFactoriesLoaderFactoryClass()
SpringFactoriesLoader
to load configuration
candidates.protected void handleInvalidExcludes(List<String> invalidExcludes)
invalidExcludes
- the list of invalid excludes (will always have at least one
element)protected Set<String> getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes)
metadata
- the source metadataattributes
- the annotation
attributes
protected List<AutoConfigurationImportFilter> getAutoConfigurationImportFilters()
protected final List<String> asList(AnnotationAttributes attributes, String name)
protected List<AutoConfigurationImportListener> getAutoConfigurationImportListeners()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
protected final ConfigurableListableBeanFactory getBeanFactory()
public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
protected ClassLoader getBeanClassLoader()
public void setEnvironment(Environment environment)
setEnvironment
in interface EnvironmentAware
protected final Environment getEnvironment()
public void setResourceLoader(ResourceLoader resourceLoader)
setResourceLoader
in interface ResourceLoaderAware
protected final ResourceLoader getResourceLoader()