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/10/23 02:56:21 UTC

[GitHub] [dubbo] CrazyHZM commented on a change in pull request #9093: [3.0] add constructor with ScopeModel arg to config bean

CrazyHZM commented on a change in pull request #9093:
URL: https://github.com/apache/dubbo/pull/9093#discussion_r734915605



##########
File path: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigBeanPostProcessor.java
##########
@@ -44,13 +55,51 @@
  *
  * @since 2.7.6
  */
-public class DubboConfigDefaultPropertyValueBeanPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig>
-        implements MergedBeanDefinitionPostProcessor, PriorityOrdered {
+public class DubboConfigBeanPostProcessor extends GenericBeanPostProcessorAdapter<AbstractConfig>
+    implements BeanDefinitionRegistryPostProcessor, PriorityOrdered, ApplicationContextAware {
 
     /**
-     * The bean name of {@link DubboConfigDefaultPropertyValueBeanPostProcessor}
+     * The bean name of {@link DubboConfigBeanPostProcessor}
      */
-    public static final String BEAN_NAME = "dubboConfigDefaultPropertyValueBeanPostProcessor";
+    public static final String BEAN_NAME = "dubboConfigBeanPostProcessor";
+
+    private ModuleModel moduleModel;
+    private ApplicationModel applicationModel;
+
+    @Override
+    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
+        //DO NOTHING
+    }
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+        String[] beanNames = beanFactory.getBeanDefinitionNames();
+        for (String beanName : beanNames) {
+            BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
+            String beanClassName = beanDefinition.getBeanClassName();
+            if (beanClassName != null && beanClassName.startsWith("org.apache.dubbo.config.")) {
+                try {

Review comment:
       Can it be adjusted to be inserted by judging the existence of this `ScopeModel` type of input parameter in the constructor.




-- 
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