pandaapo commented on issue #10765:
URL: https://github.com/apache/dubbo/issues/10765#issuecomment-1296829241

   I investigated this bug. Now I want to confirm some questions before I 
decide what to do next.
   If Spring is configured with `PropertySourcesPlaceholderConfigurer`, the 
usual way is to write `${key}` to the fields of various forms of Spring beans, 
so that the key-value configured in the property file can take effect. So 
`dubbo.consumer.tag` can work when `<dubbo:consumer tag="${key}">` is written 
in Dubbo configuration file.
   Considering you proposed this issue, I think Dubbo has made some more 
convenient work against the properties configured by user. The property may be 
applied even though `<dubbo:consumer tag="${key}">` is not written explicitly.  
**Am I right?**
   
   According my guess, I find Dubbo assigns the value from `ModuleEnvironment` 
to `XxxConfig`.  And `ModuleEnvironment`'s `appConfigMap` is built according to 
Spring `Environment` when 
`DubboInfraBeanRegisterPostProcessor#postProcessBeanFactory()` is called. **Am 
I right?**
   
   ---
   我研究了这个问题,目前有一些不确定的地方想跟您先确认一下。
   如果采用 
`PropertySourcesPlaceholderConfigurer`的方式配置Spring,按照通常的使用方式,对于各种形式的Spring 
bean,只要在需要用到所配属性的字段上写`${key}`,就能注入配置的属性值。所以Dubbo也是一样,如果写了`<dubbo:consumer 
tag="${key}">`,属性文件中配置的 `dubbo.consumer.tag`就能生效。
   但是鉴于您提了该issue,所以我猜Dubbo也许在此基础之上做了更进一步的工作,即使不用显式地写`<dubbo:consumer 
tag="${key}">`也能让 `dubbo.consumer.tag`生效。**我的理解对吗?**
   
   
按照该思路,我在源码中看到Dubbo在内部用`ModuleEnvironment`给各种`XxxConfig`赋值,而`ModuleEnvironment`是在Spring启动中`DubboInfraBeanRegisterPostProcessor#postProcessBeanFactory()`方法执行的时候构建了`appConfigMap`。**我的理解对吗?**


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to