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:
  • DubboReference
  • Reference
  • invalid reference
    com.alibaba.dubbo.config.annotation.Reference
  • Field Details

  • Constructor Details

    • ReferenceAnnotationBeanPostProcessor

      public ReferenceAnnotationBeanPostProcessor()
      invalid reference
      @com.alibaba.dubbo.config.annotation.Reference
      has been supported since 2.7.3

      @DubboReference has 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:
      postProcessBeanFactory in interface org.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:
      postProcessMergedBeanDefinition in interface org.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 the postProcessProperties(PropertyValues, Object, String), that removed as of Spring Framework 6.0.0, and in favor of postProcessProperties(PropertyValues, Object, String).

      In order to be compatible with the lower version of Spring, it is still retained.

      Specified by:
      postProcessPropertyValues in interface org.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
      Specified by:
      postProcessProperties in interface org.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:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Overrides:
      destroy in class AbstractAnnotationBeanPostProcessor
      Throws:
      Exception
    • getReferenceBeans

      @Deprecated public Collection<ReferenceBean<?>> getReferenceBeans()
      Deprecated.
      Gets all beans of ReferenceBean
    • getInjectedFieldReferenceBeanMap

      public Map<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement,ReferenceBean<?>> getInjectedFieldReferenceBeanMap()
      Get ReferenceBean Map in injected field.
      Returns:
      non-null Map
      Since:
      2.5.11
    • getInjectedMethodReferenceBeanMap

      public Map<org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement,ReferenceBean<?>> getInjectedMethodReferenceBeanMap()
      Get ReferenceBean Map in injected method.
      Returns:
      non-null Map
      Since:
      2.5.11