apache / dubbo-admin

The ops and reference implementation for Apache Dubbo
https://dubbo.apache.org
Apache License 2.0
4k stars 2.17k forks source link

zdubbo-admin换了注册中心组。服务测试失败了。看源代码RegistryConfig group是空的。 #447

Closed iwhalecloud-platform closed 5 years ago

iwhalecloud-platform commented 5 years ago

属性文件里设置:admin.registry.group=henry1 服务查询时,服务出来里。但是点击服务测试的时候失败里,提示找不到provider发现去找dubbo分组下的provider。经过调试发现RegistryConfig的group是空的。我在代码加里一句话就好了,见图:

public class GenericServiceImpl {
    private ApplicationConfig applicationConfig;
    private final Registry registry;

    public GenericServiceImpl(Registry registry) {
        this.registry = registry;
    }

    @PostConstruct
    public void init() {
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress(registry.getUrl().getProtocol() + "://" + registry.getUrl().getAddress());

        //  添加一句代码
        registryConfig.setGroup(registry.getUrl().getParameters().get("group"));

        applicationConfig = new ApplicationConfig();
        applicationConfig.setName("dubbo-admin");
        applicationConfig.setRegistry(registryConfig);
    }
}
nzomkxia commented 5 years ago

可以提一个PR么? @WhaleCloud-platform

iwhalecloud-platform commented 5 years ago

已提:https://github.com/apache/dubbo-admin/pull/449

nzomkxia commented 5 years ago

合并了