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 cbb15ac69a6..a4ffe21c58c 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 @@ -206,6 +206,7 @@ public synchronized T get() { return ref; } + @Override public synchronized void destroy() { if (ref == null) { return; @@ -234,6 +235,10 @@ public synchronized void init() { if (bootstrap == null) { bootstrap = DubboBootstrap.getInstance(); + // compatible with api call. + if (null != this.getRegistries()) { + bootstrap.registries(this.getRegistries()); + } bootstrap.initialize(); } diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java index e95fa084362..b0fc1a710c8 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java @@ -149,15 +149,18 @@ public ServiceConfig(Service service) { } @Parameter(excluded = true) + @Override public boolean isExported() { return exported; } @Parameter(excluded = true) + @Override public boolean isUnexported() { return unexported; } + @Override public void unexport() { if (!exported) { return; @@ -181,9 +184,14 @@ public void unexport() { dispatch(new ServiceConfigUnexportedEvent(this)); } + @Override public synchronized void export() { if (bootstrap == null) { bootstrap = DubboBootstrap.getInstance(); + // compatible with api call. + if (null != this.getRegistry()) { + bootstrap.registries(this.getRegistries()); + } bootstrap.initialize(); }