public class CommonAnnotationBeanPostProcessor
extends org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
implements org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor, org.springframework.core.PriorityOrdered, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
AnnotationParserCallbackAnnotation then recognize the Class to do AnnotationParserCallback| 限定符和类型 | 字段和说明 |
|---|---|
protected static org.apache.commons.logging.Log |
LOGGER
log this class
|
| 构造器和说明 |
|---|
CommonAnnotationBeanPostProcessor() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterPropertiesSet()
Initialize propertyResource instance load
|
void |
destroy()
Invoke callback destroy method
|
int |
getOrder()
get order
|
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event)
Do annotation on class type resolve action after spring container started.
|
protected void |
parseFields(Class<?> clazz,
List<Class<? extends Annotation>> annotions,
LinkedList<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement> elements)
To parse all field to find out annotation info
|
protected void |
parseMethods(Class<?> clazz,
List<Class<? extends Annotation>> annotions,
LinkedList<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement> elements)
To parse all method to find out annotation info
|
Object |
postProcessBeforeInitialization(Object bean,
String beanName)
To parse all initialized bean from spring which has target annotation matches.
|
void |
postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition,
Class beanType,
String beanName)
Post-process the given merged bean definition for the specified bean.
|
org.springframework.beans.PropertyValues |
postProcessPropertyValues(org.springframework.beans.PropertyValues pvs,
PropertyDescriptor[] pds,
Object bean,
String beanName)
Post-process the given property values before the factory applies them to the given bean.
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.
|
void |
setCallback(AnnotationParserCallback callback)
set callback
|
void |
setOrder(int order)
set order
|
determineCandidateConstructors, getEarlyBeanReference, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInstantiation, predictBeanTypepublic void setCallback(AnnotationParserCallback callback)
callback - the callback to setpublic void setOrder(int order)
order - the orderpublic int getOrder()
getOrder 在接口中 org.springframework.core.Orderedpublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean.afterPropertiesSet() or a custom init-method.
setBeanFactory 在接口中 org.springframework.beans.factory.BeanFactoryAwarebeanFactory - owning BeanFactory (never null). The bean can immediately call methods on the factory.org.springframework.beans.BeansException - in case of initialization errorsBeanInitializationExceptionpublic Object postProcessBeforeInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
postProcessBeforeInitialization 在接口中 org.springframework.beans.factory.config.BeanPostProcessorpostProcessBeforeInitialization 在类中 org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapterbean - original bean initialize by springbeanName - bean name defined in springAnnotationParserCallbackorg.springframework.beans.BeansException - in case of initialization errorspublic void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition,
Class beanType,
String beanName)
postProcessMergedBeanDefinition 在接口中 org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessorbeanDefinition - the merged bean definition for the beanbeanType - the actual type of the managed bean instancebeanName - the name of the beanpublic org.springframework.beans.PropertyValues postProcessPropertyValues(org.springframework.beans.PropertyValues pvs,
PropertyDescriptor[] pds,
Object bean,
String beanName)
throws org.springframework.beans.BeansException
Also allows for replacing the property values to apply, typically through creating a new MutablePropertyValues instance based on the original PropertyValues, adding or removing specific values.
postProcessPropertyValues 在接口中 org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorpostProcessPropertyValues 在类中 org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapterpvs - the property values that the factory is about to apply (never null)pds - the relevant property descriptors for the target bean (with ignored dependency types - which the
factory handles specifically - already filtered out)bean - the bean instance created, but whose properties have not yet been setbeanName - the name of the beannull to skip property populationorg.springframework.beans.BeansException - in case of errorsMutablePropertyValuesprotected void parseMethods(Class<?> clazz, List<Class<? extends Annotation>> annotions, LinkedList<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement> elements)
clazz - target classannotion - target annotation to findelements - injected element of all methodsprotected void parseFields(Class<?> clazz, List<Class<? extends Annotation>> annotions, LinkedList<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement> elements)
clazz - target classannotion - target annotation to findelements - injected element of all fieldspublic void destroy()
throws Exception
destroy 在接口中 org.springframework.beans.factory.DisposableBeanException - in case of callback do destroy action errorpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBeanException - in case of any errorpublic void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent 在接口中 org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>event - spring application eventCopyright © 2017. All rights reserved.