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.EnableAutoConfiguration
Modifier and Type | Class and Description |
---|---|
protected static class |
AutoConfigurationImportSelector.AutoConfigurationEntry |
Constructor and Description |
---|
AutoConfigurationImportSelector() |
Modifier and Type | Method and Description |
---|---|
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 appropriate
AnnotationAttributes from the
AnnotationMetadata . |
protected AutoConfigurationImportSelector.AutoConfigurationEntry |
getAutoConfigurationEntry(AutoConfigurationMetadata autoConfigurationMetadata,
org.springframework.core.type.AnnotationMetadata annotationMetadata)
Return the
AutoConfigurationImportSelector.AutoConfigurationEntry based on the AnnotationMetadata
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 by
SpringFactoriesLoader 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) |
public String[] selectImports(org.springframework.core.type.AnnotationMetadata annotationMetadata)
selectImports
in interface org.springframework.context.annotation.ImportSelector
protected AutoConfigurationImportSelector.AutoConfigurationEntry getAutoConfigurationEntry(AutoConfigurationMetadata autoConfigurationMetadata, org.springframework.core.type.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 org.springframework.context.annotation.DeferredImportSelector.Group> getImportGroup()
getImportGroup
in interface org.springframework.context.annotation.DeferredImportSelector
protected boolean isEnabled(org.springframework.core.type.AnnotationMetadata metadata)
protected org.springframework.core.annotation.AnnotationAttributes getAttributes(org.springframework.core.type.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(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.core.annotation.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(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.core.annotation.AnnotationAttributes attributes)
metadata
- the source metadataattributes
- the annotation
attributes
protected List<AutoConfigurationImportFilter> getAutoConfigurationImportFilters()
protected final List<String> asList(org.springframework.core.annotation.AnnotationAttributes attributes, String name)
protected List<AutoConfigurationImportListener> getAutoConfigurationImportListeners()
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
org.springframework.beans.BeansException
protected final org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory()
public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface org.springframework.beans.factory.BeanClassLoaderAware
protected ClassLoader getBeanClassLoader()
public void setEnvironment(org.springframework.core.env.Environment environment)
setEnvironment
in interface org.springframework.context.EnvironmentAware
protected final org.springframework.core.env.Environment getEnvironment()
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
protected final org.springframework.core.io.ResourceLoader getResourceLoader()
public int getOrder()
getOrder
in interface org.springframework.core.Ordered
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.