You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/07/07 07:47:14 UTC

[GitHub] [dubbo] kylixs commented on issue #8201: 重复注册 DubboBootstrapApplicationListener

kylixs commented on issue #8201:
URL: https://github.com/apache/dubbo/issues/8201#issuecomment-875372071


   Calling DubboBeanUtils#registerCommonBeans() multiple times will not register beans repeatedly, and do nothing if it has already been registered.
   ```java
       static boolean registerInfrastructureBean(BeanDefinitionRegistry beanDefinitionRegistry,
                                                        String beanName,
                                                        Class<?> beanType) {
   
           boolean registered = false;
   
           if (!beanDefinitionRegistry.containsBeanDefinition(beanName)) {
               RootBeanDefinition beanDefinition = new RootBeanDefinition(beanType);
               beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
               beanDefinitionRegistry.registerBeanDefinition(beanName, beanDefinition);
               registered = true;
   
               if (log.isDebugEnabled()) {
                   log.debug("The Infrastructure bean definition [" + beanDefinition
                           + "with name [" + beanName + "] has been registered.");
               }
           }
   
           return registered;
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org