Skip to content

dubbo.registry.address会覆盖一切自定义注册中心的值 #5224

@iwhalecloud-platform

Description

@iwhalecloud-platform
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.3
  • Operating System version: mac
  • Java version: jdk 8

Steps to reproduce this issue

注册了两个配置中心,一个用的是dubbo默认配置

dubbo.registry.address=zookeeper://127.0.0.1:2181

然后自定一个注册中心:

    @Bean
    public RegistryConfig ecareConsumerConfig() {
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("zookeeper://127.0.0.1:2182");
        registryConfig.setGroup("dubbo");
        return registryConfig;
    }

引用时,指定了注册中心ecareConsumerConfig

    @Reference(registry = "ecareConsumerConfig")
    private UserInfoApiService userInfoApiService;

然后程序启动解析时,源码走到org.apache.dubbo.config.ReferenceConfig.init()里面注册信息都是127.0.0.1:2182,继续走,当走到startConfigCenter里面调用了ConfigManager.getInstance().refreshAll();里面的AbstractConfig.refresh()不管你是否拥有值,都将里面的值覆盖掉,变成zookeeper://127.0.0.1:2181。导致注册中心找错

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?

Actual Result

What actually happens?

If there is an exception, please attach the exception trace:

Just put your stack trace here!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions