Skip to content

Commit

Permalink
Clear ReferenceAnnotationWithAotBeanPostProcessor logic (#13098)
Browse files Browse the repository at this point in the history
Signed-off-by: crazyhzm <crazyhzm@gmail.com>
  • Loading branch information
CrazyHZM authored Sep 26, 2023
1 parent 0fd51b1 commit fb0911d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 496 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public class ReferenceAnnotationBeanPostProcessor extends AbstractAnnotationBean
private final ConcurrentMap<InjectionMetadata.InjectedElement, String> injectedMethodReferenceBeanCache =
new ConcurrentHashMap<>(CACHE_SIZE);

private ApplicationContext applicationContext;
protected ApplicationContext applicationContext;

private ReferenceBeanManager referenceBeanManager;
private BeanDefinitionRegistry beanDefinitionRegistry;
protected ReferenceBeanManager referenceBeanManager;
protected BeanDefinitionRegistry beanDefinitionRegistry;

/**
* {@link com.alibaba.dubbo.config.annotation.Reference @com.alibaba.dubbo.config.annotation.Reference} has been supported since 2.7.3
Expand Down Expand Up @@ -211,7 +211,7 @@ private boolean isAnnotatedReferenceBean(BeanDefinition beanDefinition) {
* @param beanName
* @param beanDefinition
*/
private void processReferenceAnnotatedBeanDefinition(String beanName, AnnotatedBeanDefinition beanDefinition) {
protected void processReferenceAnnotatedBeanDefinition(String beanName, AnnotatedBeanDefinition beanDefinition) {

MethodMetadata factoryMethodMetadata = SpringCompatUtils.getFactoryMethodMetadata(beanDefinition);

Expand Down Expand Up @@ -500,6 +500,9 @@ public String registerReferenceBean(String propertyName, Class<?> injectedType,
beanDefinition.setAttribute(ReferenceAttributes.INTERFACE_CLASS, interfaceClass);
beanDefinition.setAttribute(ReferenceAttributes.INTERFACE_NAME, interfaceName);

beanDefinition.getPropertyValues().add(ReferenceAttributes.INTERFACE_CLASS, interfaceClass);
beanDefinition.getPropertyValues().add(ReferenceAttributes.INTERFACE_NAME, interfaceName);

// create decorated definition for reference bean, Avoid being instantiated when getting the beanType of ReferenceBean
// see org.springframework.beans.factory.support.AbstractBeanFactory#getTypeForFactoryBean()
GenericBeanDefinition targetDefinition = new GenericBeanDefinition();
Expand Down
Loading

0 comments on commit fb0911d

Please sign in to comment.