You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/05/22 08:04:36 UTC

[dubbo] branch master updated: [Dubbo-6837] fix dubbo @Service annotation bug (#6838)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 37c39c0  [Dubbo-6837] fix dubbo @Service annotation bug (#6838)
37c39c0 is described below

commit 37c39c00bc12fee4bfa222acb530b4e02a2e2839
Author: leayer <le...@msn.com>
AuthorDate: Sat May 22 16:04:17 2021 +0800

    [Dubbo-6837] fix dubbo @Service annotation bug (#6838)
    
    Co-authored-by: zhangduanzhangduan <zh...@didichuxing.com>
---
 .../spring/beans/factory/annotation/ServiceClassPostProcessor.java     | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceClassPostProcessor.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceClassPostProcessor.java
index 26038d3..aa2ab88 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceClassPostProcessor.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceClassPostProcessor.java
@@ -297,6 +297,9 @@ public class ServiceClassPostProcessor implements BeanDefinitionRegistryPostProc
 
         if (scanner.checkCandidate(beanName, serviceBeanDefinition)) { // check duplicated candidate bean
             registry.registerBeanDefinition(beanName, serviceBeanDefinition);
+            if (!serviceBeanDefinition.getPropertyValues().contains("id")) {
+                serviceBeanDefinition.getPropertyValues().addPropertyValue("id", beanName);
+            }
 
             if (logger.isInfoEnabled()) {
                 logger.info("The BeanDefinition[" + serviceBeanDefinition +