diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java index 20ce09acbec..06fced89256 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java +++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java @@ -433,6 +433,7 @@ private Instance createInstance(URL url) { Instance instance = new Instance(); instance.setIp(ip); instance.setPort(port); + instance.setWeight(newURL.getParameter(Constants.WEIGHT_KEY, Constants.DEFAULT_WEIGHT)); instance.setMetadata(new HashMap(newURL.getParameters())); return instance; } diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java index 56de76076d4..6bc26cf1a16 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java +++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java @@ -93,7 +93,6 @@ private void setProperties(URL url, Properties properties) { putPropertyIfAbsent(url, properties, NAMESPACE); putPropertyIfAbsent(url, properties, NACOS_NAMING_LOG_NAME); putPropertyIfAbsent(url, properties, ENDPOINT); - putPropertyIfAbsent(url, properties, NAMESPACE); putPropertyIfAbsent(url, properties, ACCESS_KEY); putPropertyIfAbsent(url, properties, SECRET_KEY); putPropertyIfAbsent(url, properties, CLUSTER_NAME);