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/08/17 03:27:15 UTC

[GitHub] [dubbo] wlf950328 commented on issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

wlf950328 commented on issue #10475:
URL: https://github.com/apache/dubbo/issues/10475#issuecomment-1217416771

   2.7.8版本能定位到  ReferenceConfig.init() -> ReferenceConfig.checkAndUpdateSubConfigs() -> ReferenceConfigBase.checkDefault() -> ConfigManager.getDefaultConsumer() 这里只会获取一个作为默认的ConsumerConfig
   
   ```
       public Optional<ConsumerConfig> getDefaultConsumer() {
           List<ConsumerConfig> consumerConfigs = getDefaultConfigs(getConfigsMap(getTagName(ConsumerConfig.class)));
           if (CollectionUtils.isNotEmpty(consumerConfigs)) {
               return Optional.of(consumerConfigs.get(0));
           }
           return Optional.empty();
       }
   ```
   
   
   3.0.11 能定位到 AbstractConfigManager.addConfig() 中的代码
   ```
   // 问题一
           Map<String, AbstractConfig> configsMap = (Map)this.configsCache.computeIfAbsent(AbstractConfig.getTagName(config.getClass()), (type) -> {
               return new ConcurrentHashMap();
           });
           if (!(config instanceof ReferenceConfigBase) && !(config instanceof ServiceConfigBase)) {
               Iterator var3 = configsMap.values().iterator();
   
               while(var3.hasNext()) {
                   AbstractConfig value = (AbstractConfig)var3.next();
                   if (value.equals(config)) { // 问题二
                       return value;
                   }
               }
           }
   ```
   1、两个服务放入map的key都是一样的
   2、equals并没有获取到所有属性值, 还跳过了本不一样的id属性
   
   以上是本人的调试猜测, 不一定准确


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