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 2022/11/01 13:50:01 UTC

[GitHub] [dubbo] pandaapo commented on issue #10765: dubbo.consumer.tag not work on 3.x

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

   感谢指导。和理解的差不多,那我就可以解释大概因为什么导致`dubbo.consumer.tag`不能直接生效了。
   1、对于这些属性,在Dubbo的设计中,最开始存储在`ModuleEnvironment`中,该对象是在`DubboInfraBeanRegisterPostProcessor#postProcessBeanFactory()`执行时构建的,但是在Spring的生命周期中`PropertySourcesPlaceholderConfigurer#postProcessBeanFactory()`执行时机在其之后。
   2、即使调整到`PropertySourcesPlaceholderConfigurer`执行过后,目前`ModuleEnvironment`的构建方式将依旧获取不到配置属性,https://github.com/apache/dubbo/blob/bf991e457f6378364ac6ca36f19edce1891d2804/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboInfraBeanRegisterPostProcessor.java#L86-L88 ,因为目前是根据Spring的`ConfigurableEnvironment`来构建,而`PropertySourcesPlaceholderConfigurer`并没有将解析的属性值存储到该对象,而是另外存储在`PropertySources`中。
   
   另外,还有个疑问需要跟您确认。
   如果采用Spring 3.x之后已经过时的`PropertyPlaceholderConfigurer`来配置的话,没有办法像Dubbo现在的设计这样——从Spring某对象中取出解析的属性值应用到`ModuleEnvironment`。因为`PropertyPlaceholderConfigurer`没有对外提供如`PropertySources`之类的属性集合(我从Spring源码没找到,如果有还希望大佬予以指导)。
   所以如果用过时的`PropertyPlaceholderConfigurer`,且没有显式地写`<dubbo:consumer tag="${key}">`导致`dubbo.consumer.tag`不能生效,**这个问题应该不需要解决吧?**


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