public abstract class AnnotationBeanDefinitionRegistryPostProcessor extends Object implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.EnvironmentAware, org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.BeanClassLoaderAware
BeanDefinitionRegistryPostProcessor, which will execute two main registration
methods orderly:
registerPrimaryBeanDefinitions(ExposingClassPathBeanDefinitionScanner, String[]) : Scan and register
the primary BeanDefinitions that were annotated by
the supported annotation types, and then return the Map with bean name plus
aliases if present and primary AnnotatedBeanDefinitions,
it's allowed to be override
registerSecondaryBeanDefinitions(ExposingClassPathBeanDefinitionScanner, Map, String[]) :
it's mandatory to be override by the sub-class to register secondary BeanDefinitions
if required
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.apache.commons.logging.Log |
logger |
| 构造器和说明 |
|---|
AnnotationBeanDefinitionRegistryPostProcessor(Class<? extends Annotation> primaryAnnotationType,
Class<?>... basePackageClasses) |
AnnotationBeanDefinitionRegistryPostProcessor(Class<? extends Annotation> primaryAnnotationType,
Iterable<String> packagesToScan) |
AnnotationBeanDefinitionRegistryPostProcessor(Class<? extends Annotation> primaryAnnotationType,
String... packagesToScan) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addSupportedAnnotationType(Class<? extends Annotation>... annotationTypes) |
protected static Annotation |
getAnnotation(AnnotatedElement annotatedElement,
Class<? extends Annotation> annotationType) |
org.springframework.beans.factory.config.ConfigurableListableBeanFactory |
getBeanFactory() |
ClassLoader |
getClassLoader() |
org.springframework.core.env.ConfigurableEnvironment |
getEnvironment() |
Set<String> |
getPackagesToScan() |
org.springframework.core.io.ResourceLoader |
getResourceLoader() |
protected Set<String> |
getSupportedAnnotationTypeNames() |
Set<Class<? extends Annotation>> |
getSupportedAnnotationTypes() |
void |
postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
void |
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
protected Map<String,org.springframework.beans.factory.annotation.AnnotatedBeanDefinition> |
registerPrimaryBeanDefinitions(ExposingClassPathBeanDefinitionScanner scanner,
String[] basePackages)
Scan and register the primary
BeanDefinitions that were annotated by
the supported annotation types, and then return the Map with bean name plus
aliases if present and primary AnnotatedBeanDefinitions. |
protected abstract void |
registerSecondaryBeanDefinitions(ExposingClassPathBeanDefinitionScanner scanner,
Map<String,org.springframework.beans.factory.annotation.AnnotatedBeanDefinition> primaryBeanDefinitions,
String[] basePackages)
Register the secondary
BeanDefinitions
Current method is allowed to be override by the sub-class to change the registration logic |
protected String[] |
resolveBasePackages(Set<String> packagesToScan)
Resolve the placeholders for the raw scanned packages to scan
|
protected Class<?> |
resolveBeanClass(org.springframework.beans.factory.config.BeanDefinition beanDefinition) |
protected Class<?> |
resolveBeanClass(org.springframework.beans.factory.config.BeanDefinitionHolder beanDefinitionHolder) |
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setClassLoader(ClassLoader classLoader) |
void |
setEnvironment(org.springframework.core.env.Environment environment) |
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
public AnnotationBeanDefinitionRegistryPostProcessor(Class<? extends Annotation> primaryAnnotationType, Class<?>... basePackageClasses)
public AnnotationBeanDefinitionRegistryPostProcessor(Class<? extends Annotation> primaryAnnotationType, String... packagesToScan)
public AnnotationBeanDefinitionRegistryPostProcessor(Class<? extends Annotation> primaryAnnotationType, Iterable<String> packagesToScan)
public void addSupportedAnnotationType(Class<? extends Annotation>... annotationTypes)
protected static Annotation getAnnotation(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType)
public final void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
throws org.springframework.beans.BeansException
postProcessBeanDefinitionRegistry 在接口中 org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessororg.springframework.beans.BeansExceptionprotected Map<String,org.springframework.beans.factory.annotation.AnnotatedBeanDefinition> registerPrimaryBeanDefinitions(ExposingClassPathBeanDefinitionScanner scanner, String[] basePackages)
BeanDefinitions that were annotated by
the supported annotation types, and then return the Map with bean name plus
aliases if present and primary AnnotatedBeanDefinitions.
Current method is allowed to be override by the sub-class to change the registration logic
scanner - ExposingClassPathBeanDefinitionScannerbasePackages - the base packages to scanMap with bean name plus aliases if present and primary
AnnotatedBeanDefinitionsprotected abstract void registerSecondaryBeanDefinitions(ExposingClassPathBeanDefinitionScanner scanner, Map<String,org.springframework.beans.factory.annotation.AnnotatedBeanDefinition> primaryBeanDefinitions, String[] basePackages)
BeanDefinitions
Current method is allowed to be override by the sub-class to change the registration logic
scanner - the ExposingClassPathBeanDefinitionScanner instanceprimaryBeanDefinitions - the Map with bean name plus aliases if present and primary
AnnotatedBeanDefinitions, which may be emptybasePackages - the base packages to scanpublic void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
throws org.springframework.beans.BeansException
postProcessBeanFactory 在接口中 org.springframework.beans.factory.config.BeanFactoryPostProcessororg.springframework.beans.BeansExceptionprotected String[] resolveBasePackages(Set<String> packagesToScan)
packagesToScan - the raw scanned packages to scanprotected final Class<?> resolveBeanClass(org.springframework.beans.factory.config.BeanDefinitionHolder beanDefinitionHolder)
protected final Class<?> resolveBeanClass(org.springframework.beans.factory.config.BeanDefinition beanDefinition)
public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader 在接口中 org.springframework.beans.factory.BeanClassLoaderAwarepublic Set<Class<? extends Annotation>> getSupportedAnnotationTypes()
public org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory()
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
setBeanFactory 在接口中 org.springframework.beans.factory.BeanFactoryAwareorg.springframework.beans.BeansExceptionpublic org.springframework.core.env.ConfigurableEnvironment getEnvironment()
public void setEnvironment(org.springframework.core.env.Environment environment)
setEnvironment 在接口中 org.springframework.context.EnvironmentAwarepublic org.springframework.core.io.ResourceLoader getResourceLoader()
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader 在接口中 org.springframework.context.ResourceLoaderAwarepublic ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
Copyright © 2020. All rights reserved.