Class ReferenceAnnotationBeanPostProcessor
java.lang.Object
org.apache.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor
org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.config.BeanFactoryPostProcessor,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor,org.springframework.context.ApplicationContextAware,org.springframework.context.EnvironmentAware
public class ReferenceAnnotationBeanPostProcessor
extends AbstractAnnotationBeanPostProcessor
implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.config.BeanFactoryPostProcessor
Step 1:
The purpose of implementing BeanFactoryPostProcessor is to scan the registration reference bean definition earlier,
so that it can be shared with the xml bean configuration.
Step 2:
By implementing InstantiationAwareBeanPostProcessor,
inject the reference bean instance into the fields and setter methods which annotated with DubboReference.
- Since:
- 2.5.7
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor
AbstractAnnotationBeanPostProcessor.AnnotatedFieldElement -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe bean name ofReferenceAnnotationBeanPostProcessor -
Constructor Summary
ConstructorsConstructorDescriptionhas been supported since 2.7.3invalid reference
@com.alibaba.dubbo.config.annotation.Reference -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Map<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement, ReferenceBean<?>> GetReferenceBeanMapin injected field.Map<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement, ReferenceBean<?>> GetReferenceBeanMapin injected method.Deprecated.voidpostProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) voidpostProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) org.springframework.beans.PropertyValuespostProcessProperties(org.springframework.beans.PropertyValues pvs, Object bean, String beanName) Alternatives to thepostProcessPropertyValues(PropertyValues, PropertyDescriptor[], Object, String).org.springframework.beans.PropertyValuespostProcessPropertyValues(org.springframework.beans.PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) Alternatives to thepostProcessProperties(PropertyValues, Object, String), that removed as of Spring Framework 6.0.0, and in favor ofpostProcessProperties(PropertyValues, Object, String).registerReferenceBean(String propertyName, Class<?> injectedType, Map<String, Object> attributes, Member member) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) Methods inherited from class org.apache.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor
getAnnotationType, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInitialization, postProcessBeforeInstantiation, setBeanClassLoader, setBeanFactory, setEnvironmentMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
resetBeanDefinition
-
Field Details
-
BEAN_NAME
The bean name ofReferenceAnnotationBeanPostProcessor
-
-
Constructor Details
-
ReferenceAnnotationBeanPostProcessor
public ReferenceAnnotationBeanPostProcessor()has been supported since 2.7.3invalid reference
@com.alibaba.dubbo.config.annotation.Reference@DubboReferencehas been supported since 2.7.7
-
-
Method Details
-
postProcessBeanFactory
public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
postProcessBeanFactoryin interfaceorg.springframework.beans.factory.config.BeanFactoryPostProcessor- Throws:
org.springframework.beans.BeansException
-
postProcessMergedBeanDefinition
public void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) - Specified by:
postProcessMergedBeanDefinitionin interfaceorg.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
-
postProcessPropertyValues
public org.springframework.beans.PropertyValues postProcessPropertyValues(org.springframework.beans.PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws org.springframework.beans.BeansException Alternatives to thepostProcessProperties(PropertyValues, Object, String), that removed as of Spring Framework 6.0.0, and in favor ofpostProcessProperties(PropertyValues, Object, String).In order to be compatible with the lower version of Spring, it is still retained.
- Specified by:
postProcessPropertyValuesin interfaceorg.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor- Throws:
org.springframework.beans.BeansException- See Also:
-
postProcessProperties
public org.springframework.beans.PropertyValues postProcessProperties(org.springframework.beans.PropertyValues pvs, Object bean, String beanName) throws org.springframework.beans.BeansException Alternatives to thepostProcessPropertyValues(PropertyValues, PropertyDescriptor[], Object, String).- Specified by:
postProcessPropertiesin interfaceorg.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor- Throws:
org.springframework.beans.BeansException- See Also:
-
registerReferenceBean
public String registerReferenceBean(String propertyName, Class<?> injectedType, Map<String, Object> attributes, Member member) throws org.springframework.beans.BeansException- Throws:
org.springframework.beans.BeansException
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Overrides:
destroyin classAbstractAnnotationBeanPostProcessor- Throws:
Exception
-
getReferenceBeans
Deprecated.useReferenceBeanManager.getReferences()insteadGets all beans ofReferenceBean -
getInjectedFieldReferenceBeanMap
public Map<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement,ReferenceBean<?>> getInjectedFieldReferenceBeanMap()GetReferenceBeanMapin injected field.- Returns:
- non-null
Map - Since:
- 2.5.11
-
getInjectedMethodReferenceBeanMap
public Map<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement,ReferenceBean<?>> getInjectedMethodReferenceBeanMap()GetReferenceBeanMapin injected method.- Returns:
- non-null
Map - Since:
- 2.5.11
-
ReferenceBeanManager.getReferences()instead