diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java index 80ddcda1a88..87cf70985ab 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java @@ -228,7 +228,6 @@ protected void checkMetadataReport() { */ protected List loadRegistries(boolean provider) { // check && override if necessary - checkRegistry(); List registryList = new ArrayList(); if (registries != null && !registries.isEmpty()) { for (RegistryConfig config : registries) { diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java index 898f4e6c797..5dcf189a196 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java @@ -218,6 +218,7 @@ public void checkAndUpdateSubConfigs() { inheritIfAbsentFromApplication(); } checkApplication(); + checkRegistry(); checkMetadataReport(); } diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java index 374d7353038..5f7b9612c5f 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java @@ -118,6 +118,8 @@ public void checkApplication2() throws Exception { public void testLoadRegistries() throws Exception { System.setProperty("dubbo.registry.address", "addr1"); InterfaceConfig interfaceConfig = new InterfaceConfig(); + // FIXME: now we need to check first, then load + interfaceConfig.checkRegistry(); List urls = interfaceConfig.loadRegistries(true); TestCase.assertEquals(1, urls.size()); URL url = urls.get(0);