This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 038ee3b  perf: Optimize the zookeeper timeout in all testcase (#8564)
038ee3b is described below

commit 038ee3b8e602f9c96f3b738ad4390d19be8e4228
Author: Xiong, Pin <[email protected]>
AuthorDate: Mon Aug 23 00:03:32 2021 -0500

    perf: Optimize the zookeeper timeout in all testcase (#8564)
    
    1. Support mock zookeeper instances in multiple registry center
    2. Optimize the ticktimeout and minimum and maximum of session timeout when 
creating zookeeper instance
---
 ...MultipleRegistryCenterInjvmIntegrationTest.java |  15 ++-
 ...terServiceDiscoveryRegistryIntegrationTest.java |  42 +++---
 ...RegistryCenterDubboProtocolIntegrationTest.java |  15 ++-
 ...egistryCenterExportProviderIntegrationTest.java |  18 ++-
 .../SingleRegistryCenterInjvmIntegrationTest.java  |  16 ++-
 .../registrycenter/AbstractRegistryCenter.java     | 107 ++++++++++++++++
 .../DefaultMultipleRegistryCenter.java             | 121 ------------------
 .../DefaultSingleRegistryCenter.java               | 101 ---------------
 .../dubbo/registrycenter/RegistryCenter.java       |  33 +++++
 ...r.java => ZookeeperMultipleRegistryCenter.java} |  25 +++-
 .../registrycenter/ZookeeperRegistryCenter.java    | 142 +++++++++++++++++++++
 ...ter.java => ZookeeperSingleRegistryCenter.java} |  28 ++--
 .../org/apache/dubbo/config/spring/ConfigTest.java |   8 +-
 .../dubbo/config/spring/JavaConfigBeanTest.java    |   8 +-
 .../annotation/MethodConfigCallbackTest.java       |   8 +-
 .../XmlReferenceBeanConditionalTest.java           |   8 +-
 ...nfigAnnotationReferenceBeanConditionalTest.java |   8 +-
 .../JavaConfigRawReferenceBeanConditionalTest.java |   8 +-
 .../JavaConfigReferenceBeanConditionalTest4.java   |   8 +-
 .../configprops/SpringBootConfigPropsTest.java     |  13 +-
 .../SpringBootMultipleConfigPropsTest.java         |  10 +-
 .../importxml/SpringBootImportDubboXmlTest.java    |   8 +-
 .../annotation/DubboConfigConfigurationTest.java   |   6 +-
 .../context/annotation/EnableDubboConfigTest.java  |  11 +-
 .../spring/issues/issue6000/Issue6000Test.java     |   8 +-
 .../spring/issues/issue6252/Issue6252Test.java     |  10 +-
 .../spring/issues/issue7003/Issue7003Test.java     |   8 +-
 .../consumer/PropertyConfigurerTest.java           |   8 +-
 .../consumer2/PropertySourcesConfigurerTest.java   |   8 +-
 .../consumer3/PropertySourcesInJavaConfigTest.java |  25 ++--
 .../reference/DubboConfigBeanInitializerTest.java  |   8 +-
 .../config/spring/reference/ReferenceKeyTest.java  |   8 +-
 .../javaconfig/JavaConfigReferenceBeanTest.java    |  12 +-
 .../spring/reference/localcall/LocalCallTest.java  |   8 +-
 .../spring/reference/localcall/LocalCallTest2.java |   8 +-
 .../registrycenter/AbstractRegistryCenter.java     | 107 ++++++++++++++++
 .../DefaultSingleRegistryCenter.java               | 101 ---------------
 .../spring/registrycenter/RegistryCenter.java      |  33 +++++
 ...r.java => ZookeeperMultipleRegistryCenter.java} |  42 +++---
 .../registrycenter/ZookeeperRegistryCenter.java    | 142 +++++++++++++++++++++
 ...ter.java => ZookeeperSingleRegistryCenter.java} |  26 +++-
 .../config/spring/schema/GenericServiceTest.java   |   8 +-
 42 files changed, 831 insertions(+), 506 deletions(-)

diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/multiple/injvm/MultipleRegistryCenterInjvmIntegrationTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/multiple/injvm/MultipleRegistryCenterInjvmIntegrationTest.java
index e4d5003..b67c65b 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/multiple/injvm/MultipleRegistryCenterInjvmIntegrationTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/multiple/injvm/MultipleRegistryCenterInjvmIntegrationTest.java
@@ -25,8 +25,8 @@ import org.apache.dubbo.config.RegistryConfig;
 import org.apache.dubbo.config.ProtocolConfig;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.integration.IntegrationTest;
-import org.apache.dubbo.registrycenter.DefaultMultipleRegistryCenter;
-import org.apache.dubbo.registrycenter.MultipleRegistryCenter;
+import org.apache.dubbo.registrycenter.RegistryCenter;
+import org.apache.dubbo.registrycenter.ZookeeperMultipleRegistryCenter;
 import org.apache.dubbo.rpc.ExporterListener;
 import org.apache.dubbo.rpc.Filter;
 import org.junit.jupiter.api.AfterEach;
@@ -80,14 +80,14 @@ public class MultipleRegistryCenterInjvmIntegrationTest 
implements IntegrationTe
     /**
      * Default a registry center.
      */
-    private MultipleRegistryCenter registryCenter;
+    private RegistryCenter registryCenter;
 
     @BeforeEach
     public void setUp() throws Exception {
         logger.info(getClass().getSimpleName() + " testcase is beginning...");
         DubboBootstrap.reset();
         //start all zookeeper services only once
-        registryCenter = new DefaultMultipleRegistryCenter(-1);
+        registryCenter = new ZookeeperMultipleRegistryCenter();
         registryCenter.startup();
         // initialize service config
         serviceConfig = new ServiceConfig<>();
@@ -97,8 +97,11 @@ public class MultipleRegistryCenterInjvmIntegrationTest 
implements IntegrationTe
         serviceConfig.setScope(SCOPE_LOCAL);
 
         // initailize bootstrap
-        for (RegistryConfig registryConfig : 
registryCenter.getRegistryConfigs()) {
-            DubboBootstrap.getInstance().registry(registryConfig);
+        for (RegistryCenter.Instance instance : 
registryCenter.getRegistryCenterInstance()) {
+            DubboBootstrap.getInstance().registry(new 
RegistryConfig(String.format("%s://%s:%s",
+                instance.getType(),
+                instance.getHostname(),
+                instance.getPort())));
         }
         DubboBootstrap.getInstance()
             .application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/multiple/servicediscoveryregistry/MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/multiple/servicediscoveryregistry/MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.java
index b493812..cb078d1 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/multiple/servicediscoveryregistry/MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/multiple/servicediscoveryregistry/MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.java
@@ -18,16 +18,17 @@ package 
org.apache.dubbo.integration.multiple.servicediscoveryregistry;
 
 import org.apache.dubbo.common.constants.CommonConstants;
 import org.apache.dubbo.common.extension.ExtensionLoader;
-import org.apache.dubbo.config.*;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.integration.IntegrationTest;
-import org.apache.dubbo.integration.multiple.injvm.*;
 import org.apache.dubbo.registry.RegistryServiceListener;
 import 
org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataService;
-import org.apache.dubbo.registrycenter.DefaultMultipleRegistryCenter;
-import org.apache.dubbo.registrycenter.MultipleRegistryCenter;
-import org.apache.dubbo.rpc.ExporterListener;
-import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.registrycenter.RegistryCenter;
+import org.apache.dubbo.registrycenter.ZookeeperMultipleRegistryCenter;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
@@ -39,8 +40,6 @@ import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;
 
-import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL;
-
 /**
  * The testcases are only for checking the process of exporting provider using 
service-discovery-registry protocol.
  */
@@ -75,7 +74,7 @@ public class 
MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple
     /**
      * Default a registry center.
      */
-    private MultipleRegistryCenter registryCenter;
+    private RegistryCenter registryCenter;
 
     /**
      * Define a {@link RegistryServiceListener} instance.
@@ -97,7 +96,7 @@ public class 
MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple
         logger.info(getClass().getSimpleName() + " testcase is beginning...");
         DubboBootstrap.reset();
         //start all zookeeper services only once
-        registryCenter = new DefaultMultipleRegistryCenter();
+        registryCenter = new ZookeeperMultipleRegistryCenter();
         registryCenter.startup();
         // initialize service config
         serviceConfig = new ServiceConfig<>();
@@ -106,9 +105,12 @@ public class 
MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple
         serviceConfig.setAsync(false);
 
         // initailize bootstrap
-        for (RegistryConfig registryConfig : 
registryCenter.getRegistryConfigs()) {
-            DubboBootstrap.getInstance().registry(registryConfig);
-            ports.add(registryConfig.getPort());
+        for (RegistryCenter.Instance instance : 
registryCenter.getRegistryCenterInstance()) {
+            DubboBootstrap.getInstance().registry(new 
RegistryConfig(String.format("%s://%s:%s",
+                instance.getType(),
+                instance.getHostname(),
+                instance.getPort())));
+            ports.add(instance.getPort());
         }
         DubboBootstrap.getInstance()
             .application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
@@ -137,7 +139,7 @@ public class 
MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple
         Assertions.assertFalse(serviceConfig.isExported());
 
         // ServiceDiscoveryRegistryStorage is empty
-        Assertions.assertEquals(registryServiceListener.getStorage().size(),0);
+        Assertions.assertEquals(registryServiceListener.getStorage().size(), 
0);
     }
 
     /**
@@ -165,24 +167,24 @@ public class 
MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple
      */
     private void afterExport() {
         // ServiceDiscoveryRegistry is not null
-        Assertions.assertEquals(registryServiceListener.getStorage().size(),2);
+        Assertions.assertEquals(registryServiceListener.getStorage().size(), 
2);
         // All register center has been registered and subscribed
-        for (int port: ports){
-            
Assertions.assertTrue(registryServiceListener.getStorage().contains(HOST,port));
-            ServiceDiscoveryRegistryInfoWrapper 
serviceDiscoveryRegistryInfoWrapper = 
registryServiceListener.getStorage().get(HOST,port);
+        for (int port : ports) {
+            
Assertions.assertTrue(registryServiceListener.getStorage().contains(HOST, 
port));
+            ServiceDiscoveryRegistryInfoWrapper 
serviceDiscoveryRegistryInfoWrapper = 
registryServiceListener.getStorage().get(HOST, port);
             // check if it's registered
             
Assertions.assertTrue(serviceDiscoveryRegistryInfoWrapper.isRegistered());
             // check if it's subscribed
             
Assertions.assertTrue(serviceDiscoveryRegistryInfoWrapper.isSubscribed());
             InMemoryWritableMetadataService inMemoryWritableMetadataService = 
serviceDiscoveryRegistryInfoWrapper.getInMemoryWritableMetadataService();
             // check if the count of exported urls is right or not
-            
Assertions.assertEquals(inMemoryWritableMetadataService.getExportedURLs().size(),1);
+            
Assertions.assertEquals(inMemoryWritableMetadataService.getExportedURLs().size(),
 1);
             // check the exported url is right or not.
             
Assertions.assertTrue(inMemoryWritableMetadataService.getExportedURLs()
                 .first()
                 
.contains(MultipleRegistryCenterServiceDiscoveryRegistryService.class.getName()));
             // check the count of metadatainfo is right or not.
-            
Assertions.assertEquals(inMemoryWritableMetadataService.getMetadataInfos().size(),1);
+            
Assertions.assertEquals(inMemoryWritableMetadataService.getMetadataInfos().size(),
 1);
         }
     }
 
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/SingleRegistryCenterDubboProtocolIntegrationTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/SingleRegistryCenterDubboProtocolIntegrationTest.java
index e1ffb81..6fdbb83 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/SingleRegistryCenterDubboProtocolIntegrationTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/SingleRegistryCenterDubboProtocolIntegrationTest.java
@@ -38,8 +38,8 @@ import 
org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataS
 import org.apache.dubbo.registry.client.migration.MigrationInvoker;
 import org.apache.dubbo.registry.support.AbstractRegistryFactory;
 import org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery;
-import org.apache.dubbo.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.registrycenter.SingleRegistryCenter;
+import org.apache.dubbo.registrycenter.RegistryCenter;
+import org.apache.dubbo.registrycenter.ZookeeperSingleRegistryCenter;
 import org.apache.dubbo.rpc.cluster.Directory;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
@@ -104,13 +104,13 @@ public class 
SingleRegistryCenterDubboProtocolIntegrationTest implements Integra
     /**
      * Define a registry center.
      */
-    private SingleRegistryCenter registryCenter;
+    private RegistryCenter registryCenter;
 
     @BeforeEach
     public void setUp() throws Exception {
         logger.info(getClass().getSimpleName() + " testcase is beginning...");
         DubboBootstrap.reset();
-        registryCenter = new 
DefaultSingleRegistryCenter(NetUtils.getAvailablePort());
+        registryCenter = new 
ZookeeperSingleRegistryCenter(NetUtils.getAvailablePort());
         registryCenter.startup();
         // initialize ServiceConfig
         serviceConfig = new ServiceConfig<>();
@@ -120,9 +120,14 @@ public class 
SingleRegistryCenterDubboProtocolIntegrationTest implements Integra
 
         DubboBootstrap.getInstance()
             .application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
-            .registry(registryConfig = registryCenter.getRegistryConfig())
             .protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
             .service(serviceConfig);
+        RegistryCenter.Instance instance = 
registryCenter.getRegistryCenterInstance().get(0);
+        registryConfig = new RegistryConfig(String.format("%s://%s:%s",
+            instance.getType(),
+            instance.getHostname(),
+            instance.getPort()));
+        DubboBootstrap.getInstance().registry(registryConfig);
     }
 
     @Test
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/exportprovider/SingleRegistryCenterExportProviderIntegrationTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/exportprovider/SingleRegistryCenterExportProviderIntegrationTest.java
index e8d342e..1afdb06 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/exportprovider/SingleRegistryCenterExportProviderIntegrationTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/exportprovider/SingleRegistryCenterExportProviderIntegrationTest.java
@@ -18,16 +18,17 @@ package org.apache.dubbo.integration.single.exportprovider;
 
 import org.apache.dubbo.common.constants.CommonConstants;
 import org.apache.dubbo.common.extension.ExtensionLoader;
+import org.apache.dubbo.config.RegistryConfig;
 import org.apache.dubbo.config.ServiceConfig;
 import org.apache.dubbo.config.ReferenceConfig;
-import org.apache.dubbo.config.ServiceListener;
 import org.apache.dubbo.config.ApplicationConfig;
 import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.ServiceListener;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.integration.IntegrationTest;
 import org.apache.dubbo.registry.integration.RegistryProtocolListener;
-import org.apache.dubbo.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.registrycenter.SingleRegistryCenter;
+import org.apache.dubbo.registrycenter.RegistryCenter;
+import org.apache.dubbo.registrycenter.ZookeeperMultipleRegistryCenter;
 import org.apache.dubbo.rpc.ExporterListener;
 import org.apache.dubbo.rpc.Filter;
 import org.junit.jupiter.api.AfterEach;
@@ -75,7 +76,7 @@ public class 
SingleRegistryCenterExportProviderIntegrationTest implements Integr
     /**
      * Define a registry center.
      */
-    private SingleRegistryCenter registryCenter;
+    private RegistryCenter registryCenter;
 
     /**
      * Define a {@link RegistryProtocolListener} instance.
@@ -101,7 +102,7 @@ public class 
SingleRegistryCenterExportProviderIntegrationTest implements Integr
     public void setUp() throws Exception {
         logger.info(getClass().getSimpleName() + " testcase is beginning...");
         DubboBootstrap.reset();
-        registryCenter = new DefaultSingleRegistryCenter();
+        registryCenter = new ZookeeperMultipleRegistryCenter();
         registryCenter.startup();
         // initialize service config
         serviceConfig = new ServiceConfig<>();
@@ -112,9 +113,14 @@ public class 
SingleRegistryCenterExportProviderIntegrationTest implements Integr
         // initailize bootstrap
         DubboBootstrap.getInstance()
             .application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
-            .registry(registryCenter.getRegistryConfig())
             .protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
             .service(serviceConfig);
+        RegistryCenter.Instance instance = 
registryCenter.getRegistryCenterInstance().get(0);
+        RegistryConfig registryConfig = new 
RegistryConfig(String.format("%s://%s:%s",
+            instance.getType(),
+            instance.getHostname(),
+            instance.getPort()));
+        DubboBootstrap.getInstance().registry(registryConfig);
     }
 
     /**
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/injvm/SingleRegistryCenterInjvmIntegrationTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/injvm/SingleRegistryCenterInjvmIntegrationTest.java
index 1ee0680..0c5cc47 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/injvm/SingleRegistryCenterInjvmIntegrationTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/integration/single/injvm/SingleRegistryCenterInjvmIntegrationTest.java
@@ -23,10 +23,11 @@ import org.apache.dubbo.config.ReferenceConfig;
 import org.apache.dubbo.config.ServiceListener;
 import org.apache.dubbo.config.ApplicationConfig;
 import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.integration.IntegrationTest;
-import org.apache.dubbo.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.registrycenter.SingleRegistryCenter;
+import org.apache.dubbo.registrycenter.RegistryCenter;
+import org.apache.dubbo.registrycenter.ZookeeperSingleRegistryCenter;
 import org.apache.dubbo.rpc.ExporterListener;
 import org.apache.dubbo.rpc.Filter;
 import org.junit.jupiter.api.AfterEach;
@@ -79,13 +80,13 @@ public class SingleRegistryCenterInjvmIntegrationTest 
implements IntegrationTest
     /**
      * Define a registry center.
      */
-    private SingleRegistryCenter registryCenter;
+    private RegistryCenter registryCenter;
 
     @BeforeEach
     public void setUp() throws Exception {
         logger.info(getClass().getSimpleName() + " testcase is beginning...");
         DubboBootstrap.reset();
-        registryCenter = new 
DefaultSingleRegistryCenter(NetUtils.getAvailablePort());
+        registryCenter = new 
ZookeeperSingleRegistryCenter(NetUtils.getAvailablePort());
         registryCenter.startup();
         // initialize service config
         serviceConfig = new ServiceConfig<>();
@@ -97,9 +98,14 @@ public class SingleRegistryCenterInjvmIntegrationTest 
implements IntegrationTest
         // initailize bootstrap
         DubboBootstrap.getInstance()
             .application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
-            .registry(registryCenter.getRegistryConfig())
             .protocol(new ProtocolConfig("injvm"))
             .service(serviceConfig);
+        RegistryCenter.Instance instance = 
registryCenter.getRegistryCenterInstance().get(0);
+        RegistryConfig registryConfig = new 
RegistryConfig(String.format("%s://%s:%s",
+            instance.getType(),
+            instance.getHostname(),
+            instance.getPort()));
+        DubboBootstrap.getInstance().registry(registryConfig);
     }
 
     /**
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/AbstractRegistryCenter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/AbstractRegistryCenter.java
new file mode 100644
index 0000000..3846c94
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/AbstractRegistryCenter.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.registrycenter;
+
+import org.apache.curator.test.InstanceSpec;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The abstraction of {@link RegistryCenter} implements the basic methods.
+ */
+abstract class AbstractRegistryCenter implements RegistryCenter {
+
+    /**
+     * The default data directory is null
+     */
+    private static final File DEFAULT_DATA_DIRECTORY = null;
+
+    /**
+     * The default election port is -1.
+     */
+    private static final int DEFAULT_ELECTION_PORT = -1;
+
+    /**
+     * The default quorum port is -1.
+     */
+    private static final int DEFAULT_QUORUM_PORT = -1;
+
+    /**
+     * The default value is true.
+     */
+    private static final boolean DEFAULT_DELETE_DATA_DIRECTORY_ON_CLOSE = true;
+
+    /**
+     * The default service id is -1.
+     */
+    private static final int DEFAULT_SERVER_ID = -1;
+
+    /**
+     * The default tick time is 5000
+     */
+    private static final int DEFAULT_TICK_TIME = 5 * 1000;
+
+    /**
+     * The default value is -1.
+     */
+    private static final int DEFAULT_MAX_CLIENT_CNXNS = -1;
+
+    /**
+     * The minimum session timeout.
+     */
+    private static final int DEFAULT_MINIMUM_SESSION_TIMEOUT = 
DEFAULT_TICK_TIME * 2;
+
+    /**
+     * The maximum session timeout.
+     */
+    private static final int DEFAULT_MAXIMUM_SESSION_TIMEOUT = 60 * 1000;
+
+    /**
+     * The default customer properties.
+     */
+    private static final Map<String, Object> DEFAULT_CUSTOM_PROPERTIES = new 
HashMap<>(2);
+
+    /**
+     * The default hostname.
+     */
+    private static final String DEFAULT_HOSTNAME = "127.0.0.1";
+
+    static {
+        DEFAULT_CUSTOM_PROPERTIES.put("minSessionTimeout", 
DEFAULT_MINIMUM_SESSION_TIMEOUT);
+        DEFAULT_CUSTOM_PROPERTIES.put("maxSessionTimeout", 
DEFAULT_MAXIMUM_SESSION_TIMEOUT);
+    }
+
+    /**
+     * Create an {@link InstanceSpec} instance to initialize {@link 
org.apache.curator.test.TestingServer}
+     *
+     * @param port the zookeeper server's port.
+     */
+    protected InstanceSpec createInstanceSpec(int port) {
+        return new InstanceSpec(DEFAULT_DATA_DIRECTORY,
+            port,
+            DEFAULT_ELECTION_PORT,
+            DEFAULT_QUORUM_PORT,
+            DEFAULT_DELETE_DATA_DIRECTORY_ON_CLOSE,
+            DEFAULT_SERVER_ID,
+            DEFAULT_TICK_TIME,
+            DEFAULT_MAX_CLIENT_CNXNS,
+            DEFAULT_CUSTOM_PROPERTIES,
+            DEFAULT_HOSTNAME);
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/DefaultMultipleRegistryCenter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/DefaultMultipleRegistryCenter.java
deleted file mode 100644
index 1659b9a..0000000
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/DefaultMultipleRegistryCenter.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.registrycenter;
-
-import org.apache.curator.test.TestingServer;
-import org.apache.dubbo.common.logger.Logger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.config.RegistryConfig;
-import org.apache.dubbo.rpc.RpcException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The default multiple registry center.
- */
-public class DefaultMultipleRegistryCenter implements MultipleRegistryCenter {
-
-    private static final Logger logger = 
LoggerFactory.getLogger(DefaultMultipleRegistryCenter.class);
-
-    /**
-     * Define a zookeeper server.
-     */
-    private volatile TestingServer zookeeperServer1;
-
-    /**
-     * Define a zookeeper server.
-     */
-    private volatile TestingServer zookeeperServer2;
-
-    /**
-     * The zookeeper server's default port.
-     */
-    private static final int DEFAULT_PORT = 2181;
-
-    private final int port;
-
-    public DefaultMultipleRegistryCenter() {
-        this(DEFAULT_PORT);
-    }
-
-    public DefaultMultipleRegistryCenter(int port) {
-        this.port = port;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void startup() throws RpcException {
-        try {
-            logger.info("The DefaultMultipleRegistryCenter is starting...");
-            this.zookeeperServer1 = new TestingServer(port);
-            this.zookeeperServer2 = new TestingServer();
-            logger.info("The DefaultMultipleRegistryCenter is started 
successfully");
-        } catch (Exception exception) {
-            try {
-                if (this.zookeeperServer1 != null) {
-                    this.zookeeperServer1.close();
-                }
-                if (this.zookeeperServer2 != null) {
-                    this.zookeeperServer2.close();
-                }
-            } catch (IOException e) {
-                // ignore
-            } finally {
-                this.zookeeperServer1 = null;
-                this.zookeeperServer2 = null;
-            }
-            throw new RpcException("Failed to initialize 
DefaultMultipleRegistryCenter instance", exception);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public List<RegistryConfig> getRegistryConfigs() {
-        List<RegistryConfig> registryConfigs = new ArrayList<>(2);
-        registryConfigs.add(new RegistryConfig("zookeeper://" + 
this.zookeeperServer1.getConnectString()));
-        registryConfigs.add(new RegistryConfig("zookeeper://" + 
this.zookeeperServer2.getConnectString()));
-        return registryConfigs;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void shutdown() throws RpcException {
-        try {
-            logger.info("The DefaultMultipleRegistryCenter is stopping...");
-            if (this.zookeeperServer1 != null) {
-                this.zookeeperServer1.close();
-            }
-            if (this.zookeeperServer2 != null) {
-                this.zookeeperServer2.close();
-            }
-            logger.info("The DefaultMultipleRegistryCenter is shutdown 
successfully");
-        } catch (IOException exception) {
-            throw new RpcException("Failed to close 
DefaultMultipleRegistryCenter instance", exception);
-        } finally {
-            this.zookeeperServer1 = null;
-            this.zookeeperServer2 = null;
-        }
-    }
-}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/DefaultSingleRegistryCenter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/DefaultSingleRegistryCenter.java
deleted file mode 100644
index d76c5ce..0000000
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/DefaultSingleRegistryCenter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.registrycenter;
-
-import org.apache.curator.test.TestingServer;
-import org.apache.dubbo.common.logger.Logger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.config.RegistryConfig;
-import org.apache.dubbo.rpc.RpcException;
-
-import java.io.IOException;
-
-/**
- * The default single registry center.
- */
-public class DefaultSingleRegistryCenter implements SingleRegistryCenter {
-
-    /**
-     * Initialize {@link RegistryCenter} instance.
-     */
-    public DefaultSingleRegistryCenter() {
-        this(DEFAULT_PORT);
-    }
-
-    /**
-     * Initialize {@link RegistryCenter} instance.
-     *
-     * @param port the zookeeper server's port.
-     */
-    public DefaultSingleRegistryCenter(int port) {
-        this.port = port;
-    }
-
-    private static final Logger logger = 
LoggerFactory.getLogger(DefaultSingleRegistryCenter.class);
-
-    /**
-     * The zookeeper server's default port.
-     */
-    private static final int DEFAULT_PORT = 2181;
-    /**
-     * Define a zookeeper server.
-     */
-    private volatile TestingServer zookeeperServer;
-
-    /**
-     * The zookeeper server's port.
-     */
-    private int port;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void startup() throws RpcException {
-        try {
-            logger.info("The DefaultSingleRegistryCenter is starting...");
-            this.zookeeperServer = new TestingServer(this.port, true);
-            logger.info("The DefaultSingleRegistryCenter is started 
successfully");
-        } catch (Exception exception) {
-            throw new RpcException("Failed to initialize 
DefaultSingleRegistryCenter instance", exception);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public RegistryConfig getRegistryConfig() {
-        return new RegistryConfig("zookeeper://" + 
this.zookeeperServer.getConnectString());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void shutdown() throws RpcException {
-        try {
-            logger.info("The DefaultSingleRegistryCenter is stopping...");
-            if (this.zookeeperServer != null) {
-                this.zookeeperServer.close();
-            }
-            logger.info("The DefaultSingleRegistryCenter is shutdown 
successfully");
-        } catch (IOException exception) {
-            throw new RpcException("Failed to close 
DefaultSingleRegistryCenter instance", exception);
-        }
-    }
-}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/RegistryCenter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/RegistryCenter.java
index 7daea27..fd95509 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/RegistryCenter.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/RegistryCenter.java
@@ -18,6 +18,8 @@ package org.apache.dubbo.registrycenter;
 
 import org.apache.dubbo.rpc.RpcException;
 
+import java.util.List;
+
 /**
  * The mock registry center.
  */
@@ -25,13 +27,44 @@ public interface RegistryCenter {
 
     /**
      * Start the registry center.
+     *
      * @throws RpcException when an exception occurred
      */
     void startup() throws RpcException;
 
     /**
+     * Returns the registry center instance.
+     * <p>This method can be called only after {@link #startup()} is called</p>
+     *
+     * @throws RpcException when an exception occurred
+     */
+    List<Instance> getRegistryCenterInstance() throws RpcException;
+
+    /**
      * Stop the registry center.
+     *
      * @throws RpcException when an exception occurred
      */
     void shutdown() throws RpcException;
+
+    /**
+     * The registry center instance.
+     */
+    interface Instance {
+
+        /**
+         * Returns the registry center type.
+         */
+        String getType();
+
+        /**
+         * Returns the hostname of registry center.
+         */
+        String getHostname();
+
+        /**
+         * Returns the port of registry center.
+         */
+        int getPort();
+    }
 }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/SingleRegistryCenter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperMultipleRegistryCenter.java
similarity index 55%
rename from 
dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/SingleRegistryCenter.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperMultipleRegistryCenter.java
index 2b12c74..a691b88 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/SingleRegistryCenter.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperMultipleRegistryCenter.java
@@ -16,15 +16,28 @@
  */
 package org.apache.dubbo.registrycenter;
 
-import org.apache.dubbo.config.RegistryConfig;
-
 /**
- * Mock single registry center.
+ * The default zookeeper multiple registry center.
  */
-public interface SingleRegistryCenter extends RegistryCenter {
+public class ZookeeperMultipleRegistryCenter extends ZookeeperRegistryCenter {
 
     /**
-     * Returns {@link RegistryConfig} instance.
+     * Initialize {@link ZookeeperMultipleRegistryCenter} instance.
+     *
+     * @param port1 the zookeeper server's port.
+     * @param port2 the zookeeper server's port.
      */
-    RegistryConfig getRegistryConfig();
+    public ZookeeperMultipleRegistryCenter(int port1, int port2) {
+        super(port1, port2);
+    }
+
+    /**
+     * Initialize {@link ZookeeperMultipleRegistryCenter} instance.
+     */
+    public ZookeeperMultipleRegistryCenter() {
+        this(DEFAULT_PORT1, DEFAULT_PORT2);
+    }
+
+    private static final int DEFAULT_PORT1 = 2181;
+    private static final int DEFAULT_PORT2 = 2182;
 }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperRegistryCenter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperRegistryCenter.java
new file mode 100644
index 0000000..2f00cc3
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperRegistryCenter.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.registrycenter;
+
+import org.apache.curator.test.InstanceSpec;
+import org.apache.curator.test.TestingServer;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.rpc.RpcException;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * The default implementation of registry center can support single and 
multiple registry center.
+ * <p>Each port represents an instance. You can provide multiple ports to 
build multiple registry center,
+ * if you want to create multiple registry center
+ */
+class ZookeeperRegistryCenter extends AbstractRegistryCenter {
+
+    /**
+     * Initialize the default registry center.
+     *
+     * @param ports the registry center's ports.
+     */
+    public ZookeeperRegistryCenter(int... ports) {
+        this.ports = ports;
+        this.instanceSpecs = new ArrayList<>(this.ports.length);
+        this.zookeeperServers = new ArrayList<>(this.ports.length);
+    }
+
+    private static final Logger logger = 
LoggerFactory.getLogger(ZookeeperRegistryCenter.class);
+
+    /**
+     * The type of the registry center.
+     */
+    private static final String DEFAULT_REGISTRY_CENTER_TYPE = "zookeeper";
+
+    private int[] ports;
+
+    private List<InstanceSpec> instanceSpecs;
+
+    private List<TestingServer> zookeeperServers;
+
+    private AtomicBoolean started = new AtomicBoolean(false);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void startup() throws RpcException {
+        try {
+            if (started.compareAndSet(false, true)) {
+                logger.info("The ZookeeperRegistryCenter is starting...");
+                for (int port : this.ports) {
+                    InstanceSpec instanceSpec = this.createInstanceSpec(port);
+                    this.instanceSpecs.add(instanceSpec);
+                    this.zookeeperServers.add(new TestingServer(instanceSpec, 
true));
+                }
+                logger.info("The ZookeeperRegistryCenter is started 
successfully");
+            }
+        } catch (Exception exception) {
+            started.set(false);
+            throw new RpcException("Failed to initialize 
ZookeeperRegistryCenter instance", exception);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<Instance> getRegistryCenterInstance() throws RpcException {
+        this.startup();
+        List<Instance> instances = new ArrayList<>(this.instanceSpecs.size());
+        for (InstanceSpec instanceSpec : this.instanceSpecs) {
+            instances.add(new Instance() {
+                @Override
+                public String getType() {
+                    return DEFAULT_REGISTRY_CENTER_TYPE;
+                }
+
+                @Override
+                public String getHostname() {
+                    return instanceSpec.getHostname();
+                }
+
+                @Override
+                public int getPort() {
+                    return instanceSpec.getPort();
+                }
+            });
+        }
+        return instances;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void shutdown() throws RpcException {
+        logger.info("The ZookeeperRegistryCenter is stopping...");
+        List<RpcException> exceptions = new 
ArrayList<>(this.zookeeperServers.size());
+        for (TestingServer testingServer : this.zookeeperServers) {
+            try {
+                testingServer.close();
+                logger.info(String.format("The zookeeper instance of %s is 
shutdown successfully",
+                    testingServer.getConnectString()));
+            } catch (IOException exception) {
+                RpcException rpcException = new 
RpcException(String.format("Failed to close zookeeper instance of %s",
+                    testingServer.getConnectString()),
+                    exception);
+                exceptions.add(rpcException);
+                logger.error(rpcException);
+            }
+        }
+        this.instanceSpecs.clear();
+        this.zookeeperServers.clear();
+        if (!exceptions.isEmpty()) {
+            logger.info("The ZookeeperRegistryCenter failed to close.");
+            // throw any one of exceptions
+            throw exceptions.get(0);
+        } else {
+            logger.info("The ZookeeperRegistryCenter close successfully.");
+        }
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/MultipleRegistryCenter.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperSingleRegistryCenter.java
similarity index 59%
rename from 
dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/MultipleRegistryCenter.java
rename to 
dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperSingleRegistryCenter.java
index 543b52e..04e8f85 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/MultipleRegistryCenter.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/registrycenter/ZookeeperSingleRegistryCenter.java
@@ -16,17 +16,29 @@
  */
 package org.apache.dubbo.registrycenter;
 
-import org.apache.dubbo.config.RegistryConfig;
-
-import java.util.List;
-
 /**
- * Mock multiple registry center.
+ * The default zookeeper single registry center.
  */
-public interface MultipleRegistryCenter extends RegistryCenter {
+public class ZookeeperSingleRegistryCenter extends ZookeeperRegistryCenter {
+
+    /**
+     * Initialize {@link ZookeeperSingleRegistryCenter} instance.
+     */
+    public ZookeeperSingleRegistryCenter() {
+        this(DEFAULT_PORT);
+    }
+
+    /**
+     * Initialize {@link RegistryCenter} instance.
+     *
+     * @param port the zookeeper server's port.
+     */
+    public ZookeeperSingleRegistryCenter(int port) {
+        super(port);
+    }
 
     /**
-     * Returns {@link RegistryConfig} instances.
+     * The zookeeper server's default port.
      */
-    List<RegistryConfig> getRegistryConfigs();
+    private static final int DEFAULT_PORT = 2181;
 }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java
index 401fab0..af880a2 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java
@@ -42,8 +42,8 @@ import org.apache.dubbo.config.spring.impl.HelloServiceImpl;
 import org.apache.dubbo.config.spring.impl.NotifyService;
 import org.apache.dubbo.config.spring.registry.MockRegistry;
 import org.apache.dubbo.config.spring.registry.MockRegistryFactory;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
 import org.apache.dubbo.registry.Registry;
 import org.apache.dubbo.registry.RegistryService;
 import org.apache.dubbo.rpc.Exporter;
@@ -88,11 +88,11 @@ public class ConfigTest {
 
     private static String resourcePath = 
ConfigTest.class.getPackage().getName().replace('.', '/');
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
     }
 
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/JavaConfigBeanTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/JavaConfigBeanTest.java
index 2514121..43be931 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/JavaConfigBeanTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/JavaConfigBeanTest.java
@@ -28,8 +28,8 @@ import org.apache.dubbo.config.context.ConfigManager;
 import org.apache.dubbo.config.spring.api.DemoService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import org.apache.dubbo.config.spring.impl.DemoServiceImpl;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
 import org.apache.dubbo.rpc.Constants;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 import org.junit.jupiter.api.AfterEach;
@@ -49,11 +49,11 @@ public class JavaConfigBeanTest {
 
     private static final String MY_PROTOCOL_ID = "myProtocol";
     private static final String MY_REGISTRY_ID = "my-registry";
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
     }
 
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MethodConfigCallbackTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MethodConfigCallbackTest.java
index e81230f..1f0c6bf 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MethodConfigCallbackTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MethodConfigCallbackTest.java
@@ -23,8 +23,8 @@ import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.api.MethodCallback;
 import 
org.apache.dubbo.config.spring.context.annotation.provider.ProviderConfiguration;
 import org.apache.dubbo.config.spring.impl.MethodCallbackImpl;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.AfterAll;
@@ -55,11 +55,11 @@ import 
org.springframework.test.context.junit.jupiter.SpringExtension;
 @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
 public class MethodConfigCallbackTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional1/XmlReferenceBeanConditionalTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional1/XmlReferenceBeanConditionalTest.java
index 99a4aee..17cc50b 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional1/XmlReferenceBeanConditionalTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional1/XmlReferenceBeanConditionalTest.java
@@ -18,8 +18,8 @@ package org.apache.dubbo.config.spring.boot.conditional1;
 
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.api.HelloService;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
@@ -50,11 +50,11 @@ import java.util.Map;
 //@ComponentScan
 public class XmlReferenceBeanConditionalTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll(){
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional2/JavaConfigAnnotationReferenceBeanConditionalTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional2/JavaConfigAnnotationReferenceBeanConditionalTest.java
index 3a9ed93..ba33808 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional2/JavaConfigAnnotationReferenceBeanConditionalTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional2/JavaConfigAnnotationReferenceBeanConditionalTest.java
@@ -22,8 +22,8 @@ import org.apache.dubbo.config.spring.ReferenceBean;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import 
org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
@@ -56,11 +56,11 @@ import java.util.Map;
 @EnableDubbo
 public class JavaConfigAnnotationReferenceBeanConditionalTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll(){
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional3/JavaConfigRawReferenceBeanConditionalTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional3/JavaConfigRawReferenceBeanConditionalTest.java
index 32c52d9..3e87455 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional3/JavaConfigRawReferenceBeanConditionalTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional3/JavaConfigRawReferenceBeanConditionalTest.java
@@ -22,8 +22,8 @@ import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import 
org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
 import org.apache.dubbo.config.spring.reference.ReferenceBeanBuilder;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
@@ -56,11 +56,11 @@ import java.util.Map;
 @EnableDubbo
 public class JavaConfigRawReferenceBeanConditionalTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll(){
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional4/JavaConfigReferenceBeanConditionalTest4.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional4/JavaConfigReferenceBeanConditionalTest4.java
index 7bec3f4..9199a3f 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional4/JavaConfigReferenceBeanConditionalTest4.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional4/JavaConfigReferenceBeanConditionalTest4.java
@@ -22,8 +22,8 @@ import org.apache.dubbo.config.spring.ReferenceBean;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import 
org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
@@ -56,11 +56,11 @@ import java.util.Map;
 @EnableDubbo
 public class JavaConfigReferenceBeanConditionalTest4 {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll(){
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootConfigPropsTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootConfigPropsTest.java
index 1fe5523..6697cd0 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootConfigPropsTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootConfigPropsTest.java
@@ -26,9 +26,11 @@ import org.apache.dubbo.config.MonitorConfig;
 import org.apache.dubbo.config.ProtocolConfig;
 import org.apache.dubbo.config.ProviderConfig;
 import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.context.ConfigManager;
-import org.apache.dubbo.config.spring.registrycenter.ZooKeeperServer;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.AfterAll;
@@ -67,14 +69,19 @@ import java.util.List;
 @EnableDubbo
 public class SpringBootConfigPropsTest {
 
+    private static RegistryCenter multipleRegistryCenter;
+
     @BeforeAll
     public static void beforeAll() {
-        ZooKeeperServer.start();
+        multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
+        multipleRegistryCenter.startup();
+        DubboBootstrap.reset();
     }
 
     @AfterAll
     public static void afterAll() {
-        ZooKeeperServer.shutdown();
+        DubboBootstrap.reset();
+        multipleRegistryCenter.shutdown();
     }
 
     @Autowired
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootMultipleConfigPropsTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootMultipleConfigPropsTest.java
index 734f724..46b48bb 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootMultipleConfigPropsTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootMultipleConfigPropsTest.java
@@ -28,8 +28,9 @@ import org.apache.dubbo.config.ProviderConfig;
 import org.apache.dubbo.config.RegistryConfig;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.context.ConfigManager;
-import org.apache.dubbo.config.spring.registrycenter.ZooKeeperServer;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.AfterAll;
@@ -67,16 +68,19 @@ import java.util.List;
 @EnableDubbo
 public class SpringBootMultipleConfigPropsTest {
 
+    private static RegistryCenter multipleRegistryCenter;
+
     @BeforeAll
     public static void beforeAll() {
-        ZooKeeperServer.start();
+        multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
+        multipleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
 
     @AfterAll
     public static void afterAll() {
         DubboBootstrap.reset();
-        ZooKeeperServer.shutdown();
+        multipleRegistryCenter.shutdown();
     }
 
     @Autowired
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml/SpringBootImportDubboXmlTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml/SpringBootImportDubboXmlTest.java
index 9a86f86..0efc4e9 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml/SpringBootImportDubboXmlTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml/SpringBootImportDubboXmlTest.java
@@ -18,8 +18,8 @@ package org.apache.dubbo.config.spring.boot.importxml;
 
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.api.HelloService;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
@@ -44,11 +44,11 @@ import 
org.springframework.context.annotation.ImportResource;
 
@ImportResource("classpath:/org/apache/dubbo/config/spring/boot/importxml/consumer/dubbo-consumer.xml")
 public class SpringBootImportDubboXmlTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll(){
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java
index 10c9f71..3898b3e 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java
@@ -22,8 +22,8 @@ import org.apache.dubbo.config.ProtocolConfig;
 import org.apache.dubbo.config.RegistryConfig;
 
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
@@ -83,7 +83,7 @@ public class DubboConfigConfigurationTest {
 
     @Test
     public void testMultiple() {
-        SingleRegistryCenter singleRegistryCenter = new 
DefaultSingleRegistryCenter();
+        RegistryCenter singleRegistryCenter = new 
ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         try{
             context.register(DubboConfigConfiguration.Multiple.class);
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java
index 9f12ad1..666e0f1 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java
@@ -26,7 +26,8 @@ import org.apache.dubbo.config.RegistryConfig;
 
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.context.ConfigManager;
-import org.apache.dubbo.config.spring.registrycenter.ZooKeeperServer;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
@@ -47,13 +48,19 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
  */
 public class EnableDubboConfigTest {
 
+    private RegistryCenter multipleRegistryCenter;
+
     @BeforeEach
     public void setUp() {
+        multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
+        multipleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
 
     @AfterEach
     public void tearDown() {
+        DubboBootstrap.reset();
+        multipleRegistryCenter.shutdown();
     }
 
     //@Test
@@ -101,8 +108,6 @@ public class EnableDubboConfigTest {
     //@Test
     public void testMultiple() {
 
-        ZooKeeperServer.start();
-
         AnnotationConfigApplicationContext context = new 
AnnotationConfigApplicationContext();
         context.register(TestMultipleConfig.class);
         context.refresh();
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java
index a7a4670..d055170 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java
@@ -19,8 +19,8 @@ package org.apache.dubbo.config.spring.issues.issue6000;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import org.apache.dubbo.config.spring.issues.issue6000.adubbo.HelloDubbo;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.AfterAll;
@@ -40,11 +40,11 @@ import 
org.springframework.context.annotation.PropertySource;
 @PropertySource("classpath:/META-INF/issues/issue6000/config.properties")
 public class Issue6000Test {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6252/Issue6252Test.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6252/Issue6252Test.java
index 7090061..b7609e4 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6252/Issue6252Test.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6252/Issue6252Test.java
@@ -18,9 +18,10 @@ package org.apache.dubbo.config.spring.issues.issue6252;
 
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
-import org.apache.dubbo.config.spring.registrycenter.ZooKeeperServer;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.config.spring.api.DemoService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -38,16 +39,19 @@ import 
org.springframework.context.annotation.PropertySource;
 @PropertySource("classpath:/META-INF/issues/issue6252/config.properties")
 public class Issue6252Test {
 
+    private static RegistryCenter multipleRegistryCenter;
+
     @BeforeAll
     public static void beforeAll() {
-        ZooKeeperServer.start();
+        multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
+        multipleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
 
     @AfterAll
     public static void afterAll() {
         DubboBootstrap.reset();
-        ZooKeeperServer.shutdown();
+        multipleRegistryCenter.shutdown();
     }
 
     @DubboReference
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue7003/Issue7003Test.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue7003/Issue7003Test.java
index 8534009..869770b 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue7003/Issue7003Test.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue7003/Issue7003Test.java
@@ -22,8 +22,8 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.ReferenceBean;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
@@ -49,11 +49,11 @@ import java.util.Map;
 @PropertySource("classpath:/META-INF/issues/issue7003/config.properties")
 public class Issue7003Test {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer/PropertyConfigurerTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer/PropertyConfigurerTest.java
index c9acd72..fc9e03a 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer/PropertyConfigurerTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer/PropertyConfigurerTest.java
@@ -20,8 +20,8 @@ import org.apache.dubbo.common.URL;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 
 import org.junit.jupiter.api.AfterAll;
@@ -40,11 +40,11 @@ import java.util.concurrent.ConcurrentMap;
 
 public class PropertyConfigurerTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer2/PropertySourcesConfigurerTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer2/PropertySourcesConfigurerTest.java
index 323803e..c8edbc3 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer2/PropertySourcesConfigurerTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer2/PropertySourcesConfigurerTest.java
@@ -21,8 +21,8 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import 
org.apache.dubbo.config.spring.propertyconfigurer.consumer.DemoBeanFactoryPostProcessor;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 
 import org.junit.jupiter.api.AfterAll;
@@ -41,11 +41,11 @@ import java.util.concurrent.ConcurrentMap;
 
 public class PropertySourcesConfigurerTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer3/PropertySourcesInJavaConfigTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer3/PropertySourcesInJavaConfigTest.java
index f7d066c..4d88db2 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer3/PropertySourcesInJavaConfigTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer3/PropertySourcesInJavaConfigTest.java
@@ -21,15 +21,11 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import 
org.apache.dubbo.config.spring.propertyconfigurer.consumer.DemoBeanFactoryPostProcessor;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.*;
 import 
org.springframework.context.annotation.AnnotationConfigApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
@@ -40,6 +36,7 @@ import 
org.springframework.context.support.ClassPathXmlApplicationContext;
 import 
org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
 import org.springframework.core.io.ClassPathResource;
 
+import java.io.IOException;
 import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
 
@@ -48,16 +45,18 @@ public class PropertySourcesInJavaConfigTest {
     private static final String SCAN_PACKAGE_NAME = 
"org.apache.dubbo.config.spring.propertyconfigurer.consumer3.notexist";
     private static final String PACKAGE_PATH = 
"/org/apache/dubbo/config/spring/propertyconfigurer/consumer3";
     private static final String PROVIDER_CONFIG_PATH = 
"org/apache/dubbo/config/spring/propertyconfigurer/provider/dubbo-provider.xml";
-    private static SingleRegistryCenter singleRegistryCenter;
+    private RegistryCenter singleRegistryCenter;
 
-    @BeforeAll
-    public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+    @BeforeEach
+    public void setUp() throws Exception {
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
+        DubboBootstrap.reset();
     }
 
-    @AfterAll
-    public static void afterAll() {
+    @AfterEach
+    public void tearDown() throws IOException {
+        DubboBootstrap.reset();
         singleRegistryCenter.shutdown();
     }
 
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java
index 1f13a62..4748d63 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java
@@ -19,8 +19,8 @@ package org.apache.dubbo.config.spring.reference;
 
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.DubboConfigBeanInitializer;
 import 
org.apache.dubbo.config.spring.context.annotation.provider.ProviderConfiguration;
@@ -60,10 +60,10 @@ import java.util.List;
 @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
 public class DubboConfigBeanInitializerTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/ReferenceKeyTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/ReferenceKeyTest.java
index 36fb780..32b2ac8 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/ReferenceKeyTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/ReferenceKeyTest.java
@@ -26,8 +26,8 @@ import org.apache.dubbo.config.spring.api.DemoService;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.impl.DemoServiceImpl;
 import org.apache.dubbo.config.spring.impl.HelloServiceImpl;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.AfterAll;
@@ -48,11 +48,11 @@ import java.util.Map;
 
 public class ReferenceKeyTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
     }
 
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/javaconfig/JavaConfigReferenceBeanTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/javaconfig/JavaConfigReferenceBeanTest.java
index 805b09a..7228166 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/javaconfig/JavaConfigReferenceBeanTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/javaconfig/JavaConfigReferenceBeanTest.java
@@ -21,13 +21,14 @@ import org.apache.dubbo.config.annotation.DubboService;
 import org.apache.dubbo.config.annotation.Reference;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.ReferenceBean;
-import org.apache.dubbo.config.spring.registrycenter.ZooKeeperServer;
 import org.apache.dubbo.config.spring.api.DemoService;
 import org.apache.dubbo.config.spring.api.HelloService;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import org.apache.dubbo.config.spring.extension.SpringExtensionFactory;
 import org.apache.dubbo.config.spring.impl.HelloServiceImpl;
 import org.apache.dubbo.config.spring.reference.ReferenceBeanBuilder;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
 import org.apache.dubbo.rpc.service.GenericException;
 import org.apache.dubbo.rpc.service.GenericService;
 import org.junit.jupiter.api.Assertions;
@@ -49,14 +50,19 @@ import java.util.Map;
 
 public class JavaConfigReferenceBeanTest {
 
+    private static RegistryCenter multipleRegistryCenter;
+
     @BeforeAll
     public static void beforeAll() {
-        ZooKeeperServer.start();
+        multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
+        multipleRegistryCenter.startup();
+        DubboBootstrap.reset();
     }
 
     @AfterAll
     public static void afterAll() {
-        ZooKeeperServer.shutdown();
+        DubboBootstrap.reset();
+        multipleRegistryCenter.shutdown();
     }
 
     @BeforeEach
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java
index 1300c35..4f5424a 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java
@@ -18,8 +18,8 @@ package org.apache.dubbo.config.spring.reference.localcall;
 
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.api.HelloService;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
@@ -39,11 +39,11 @@ import static 
org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER
 @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD)
 public class LocalCallTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest2.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest2.java
index d642f4c..5eb1a98 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest2.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest2.java
@@ -19,8 +19,8 @@ package org.apache.dubbo.config.spring.reference.localcall;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.spring.api.HelloService;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
@@ -39,11 +39,11 @@ import static 
org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER
 @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD)
 public class LocalCallTest2 {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void setUp() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/AbstractRegistryCenter.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/AbstractRegistryCenter.java
new file mode 100644
index 0000000..3ac9873
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/AbstractRegistryCenter.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.config.spring.registrycenter;
+
+import org.apache.curator.test.InstanceSpec;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The abstraction of {@link RegistryCenter} implements the basic methods.
+ */
+abstract class AbstractRegistryCenter implements RegistryCenter {
+
+    /**
+     * The default data directory is null
+     */
+    private static final File DEFAULT_DATA_DIRECTORY = null;
+
+    /**
+     * The default election port is -1.
+     */
+    private static final int DEFAULT_ELECTION_PORT = -1;
+
+    /**
+     * The default quorum port is -1.
+     */
+    private static final int DEFAULT_QUORUM_PORT = -1;
+
+    /**
+     * The default value is true.
+     */
+    private static final boolean DEFAULT_DELETE_DATA_DIRECTORY_ON_CLOSE = true;
+
+    /**
+     * The default service id is -1.
+     */
+    private static final int DEFAULT_SERVER_ID = -1;
+
+    /**
+     * The default tick time is 5000
+     */
+    private static final int DEFAULT_TICK_TIME = 5 * 1000;
+
+    /**
+     * The default value is -1.
+     */
+    private static final int DEFAULT_MAX_CLIENT_CNXNS = -1;
+
+    /**
+     * The minimum session timeout.
+     */
+    private static final int DEFAULT_MINIMUM_SESSION_TIMEOUT = 
DEFAULT_TICK_TIME * 2;
+
+    /**
+     * The maximum session timeout.
+     */
+    private static final int DEFAULT_MAXIMUM_SESSION_TIMEOUT = 60 * 1000;
+
+    /**
+     * The default customer properties.
+     */
+    private static final Map<String, Object> DEFAULT_CUSTOM_PROPERTIES = new 
HashMap<>(2);
+
+    /**
+     * The default hostname.
+     */
+    private static final String DEFAULT_HOSTNAME = "127.0.0.1";
+
+    static {
+        DEFAULT_CUSTOM_PROPERTIES.put("minSessionTimeout", 
DEFAULT_MINIMUM_SESSION_TIMEOUT);
+        DEFAULT_CUSTOM_PROPERTIES.put("maxSessionTimeout", 
DEFAULT_MAXIMUM_SESSION_TIMEOUT);
+    }
+
+    /**
+     * Create an {@link InstanceSpec} instance to initialize {@link 
org.apache.curator.test.TestingServer}
+     *
+     * @param port the zookeeper server's port.
+     */
+    protected InstanceSpec createInstanceSpec(int port) {
+        return new InstanceSpec(DEFAULT_DATA_DIRECTORY,
+            port,
+            DEFAULT_ELECTION_PORT,
+            DEFAULT_QUORUM_PORT,
+            DEFAULT_DELETE_DATA_DIRECTORY_ON_CLOSE,
+            DEFAULT_SERVER_ID,
+            DEFAULT_TICK_TIME,
+            DEFAULT_MAX_CLIENT_CNXNS,
+            DEFAULT_CUSTOM_PROPERTIES,
+            DEFAULT_HOSTNAME);
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/DefaultSingleRegistryCenter.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/DefaultSingleRegistryCenter.java
deleted file mode 100644
index 580dd2d..0000000
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/DefaultSingleRegistryCenter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.config.spring.registrycenter;
-
-import org.apache.curator.test.TestingServer;
-import org.apache.dubbo.common.logger.Logger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.config.RegistryConfig;
-import org.apache.dubbo.rpc.RpcException;
-
-import java.io.IOException;
-
-/**
- * The default single registry center.
- */
-public class DefaultSingleRegistryCenter implements SingleRegistryCenter {
-
-    /**
-     * Initialize {@link RegistryCenter} instance.
-     */
-    public DefaultSingleRegistryCenter() {
-        this(DEFAULT_PORT);
-    }
-
-    /**
-     * Initialize {@link RegistryCenter} instance.
-     *
-     * @param port the zookeeper server's port.
-     */
-    public DefaultSingleRegistryCenter(int port) {
-        this.port = port;
-    }
-
-    private static final Logger logger = 
LoggerFactory.getLogger(DefaultSingleRegistryCenter.class);
-
-    /**
-     * The zookeeper server's default port.
-     */
-    private static final int DEFAULT_PORT = 2181;
-    /**
-     * Define a zookeeper server.
-     */
-    private volatile TestingServer zookeeperServer;
-
-    /**
-     * The zookeeper server's port.
-     */
-    private int port;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void startup() throws RpcException {
-        try {
-            logger.info("The DefaultSingleRegistryCenter is starting...");
-            this.zookeeperServer = new TestingServer(this.port, true);
-            logger.info("The DefaultSingleRegistryCenter is started 
successfully");
-        } catch (Exception exception) {
-            throw new RpcException("Failed to initialize 
DefaultSingleRegistryCenter instance", exception);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public RegistryConfig getRegistryConfig() {
-        return new RegistryConfig("zookeeper://" + 
this.zookeeperServer.getConnectString());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void shutdown() throws RpcException {
-        try {
-            logger.info("The DefaultSingleRegistryCenter is stopping...");
-            if (this.zookeeperServer != null) {
-                this.zookeeperServer.close();
-            }
-            logger.info("The DefaultSingleRegistryCenter is shutdown 
successfully");
-        } catch (IOException exception) {
-            throw new RpcException("Failed to close 
DefaultSingleRegistryCenter instance", exception);
-        }
-    }
-}
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/RegistryCenter.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/RegistryCenter.java
index a1cd686..c3b1d71 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/RegistryCenter.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/RegistryCenter.java
@@ -18,6 +18,8 @@ package org.apache.dubbo.config.spring.registrycenter;
 
 import org.apache.dubbo.rpc.RpcException;
 
+import java.util.List;
+
 /**
  * The mock registry center.
  */
@@ -25,13 +27,44 @@ public interface RegistryCenter {
 
     /**
      * Start the registry center.
+     *
      * @throws RpcException when an exception occurred
      */
     void startup() throws RpcException;
 
     /**
+     * Returns the registry center instance.
+     * <p>This method can be called only after {@link #startup()} is called</p>
+     *
+     * @throws RpcException when an exception occurred
+     */
+    List<Instance> getRegistryCenterInstance() throws RpcException;
+
+    /**
      * Stop the registry center.
+     *
      * @throws RpcException when an exception occurred
      */
     void shutdown() throws RpcException;
+
+    /**
+     * The registry center instance.
+     */
+    interface Instance {
+
+        /**
+         * Returns the registry center type.
+         */
+        String getType();
+
+        /**
+         * Returns the hostname of registry center.
+         */
+        String getHostname();
+
+        /**
+         * Returns the port of registry center.
+         */
+        int getPort();
+    }
 }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZooKeeperServer.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperMultipleRegistryCenter.java
similarity index 55%
rename from 
dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZooKeeperServer.java
rename to 
dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperMultipleRegistryCenter.java
index c69000b..ff6f3c7 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZooKeeperServer.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperMultipleRegistryCenter.java
@@ -16,30 +16,28 @@
  */
 package org.apache.dubbo.config.spring.registrycenter;
 
-import org.apache.dubbo.config.spring.EmbeddedZooKeeper;
-
-public class ZooKeeperServer {
-
-    private static EmbeddedZooKeeper zookeeper1;
-    private static EmbeddedZooKeeper zookeeper2;
+/**
+ * The default zookeeper multiple registry center.
+ */
+public class ZookeeperMultipleRegistryCenter extends ZookeeperRegistryCenter {
 
-    public static void start() {
-            if (zookeeper1 == null) {
-                zookeeper1 = new EmbeddedZooKeeper(2181, true);
-                zookeeper1.start();
-            }
-            if (zookeeper2 == null) {
-                zookeeper2 = new EmbeddedZooKeeper(2182, true);
-                zookeeper2.start();
-            }
+    /**
+     * Initialize {@link ZookeeperMultipleRegistryCenter} instance.
+     *
+     * @param port1 the zookeeper server's port.
+     * @param port2 the zookeeper server's port.
+     */
+    public ZookeeperMultipleRegistryCenter(int port1, int port2) {
+        super(port1, port2);
     }
 
-    public static void shutdown() {
-        if (zookeeper1 != null) {
-            zookeeper1.stop();
-        }
-        if (zookeeper2 != null) {
-            zookeeper2.stop();
-        }
+    /**
+     * Initialize {@link ZookeeperMultipleRegistryCenter} instance.
+     */
+    public ZookeeperMultipleRegistryCenter() {
+        this(DEFAULT_PORT1, DEFAULT_PORT2);
     }
+
+    private static final int DEFAULT_PORT1 = 2181;
+    private static final int DEFAULT_PORT2 = 2182;
 }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperRegistryCenter.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperRegistryCenter.java
new file mode 100644
index 0000000..72ab13a
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperRegistryCenter.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.config.spring.registrycenter;
+
+import org.apache.curator.test.InstanceSpec;
+import org.apache.curator.test.TestingServer;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.rpc.RpcException;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * The default implementation of registry center can support single and 
multiple registry center.
+ * <p>Each port represents an instance. You can provide multiple ports to 
build multiple registry center,
+ * if you want to create multiple registry center
+ */
+class ZookeeperRegistryCenter extends AbstractRegistryCenter {
+
+    /**
+     * Initialize the default registry center.
+     *
+     * @param ports the registry center's ports.
+     */
+    public ZookeeperRegistryCenter(int... ports) {
+        this.ports = ports;
+        this.instanceSpecs = new ArrayList<>(this.ports.length);
+        this.zookeeperServers = new ArrayList<>(this.ports.length);
+    }
+
+    private static final Logger logger = 
LoggerFactory.getLogger(ZookeeperRegistryCenter.class);
+
+    /**
+     * The type of the registry center.
+     */
+    private static final String DEFAULT_REGISTRY_CENTER_TYPE = "zookeeper";
+
+    private int[] ports;
+
+    private List<InstanceSpec> instanceSpecs;
+
+    private List<TestingServer> zookeeperServers;
+
+    private AtomicBoolean started = new AtomicBoolean(false);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void startup() throws RpcException {
+        try {
+            if (started.compareAndSet(false, true)) {
+                logger.info("The ZookeeperRegistryCenter is starting...");
+                for (int port : this.ports) {
+                    InstanceSpec instanceSpec = this.createInstanceSpec(port);
+                    this.instanceSpecs.add(instanceSpec);
+                    this.zookeeperServers.add(new TestingServer(instanceSpec, 
true));
+                }
+                logger.info("The ZookeeperRegistryCenter is started 
successfully");
+            }
+        } catch (Exception exception) {
+            started.set(false);
+            throw new RpcException("Failed to initialize 
ZookeeperRegistryCenter instance", exception);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<Instance> getRegistryCenterInstance() throws RpcException {
+        this.startup();
+        List<Instance> instances = new ArrayList<>(this.instanceSpecs.size());
+        for (InstanceSpec instanceSpec : this.instanceSpecs) {
+            instances.add(new Instance() {
+                @Override
+                public String getType() {
+                    return DEFAULT_REGISTRY_CENTER_TYPE;
+                }
+
+                @Override
+                public String getHostname() {
+                    return instanceSpec.getHostname();
+                }
+
+                @Override
+                public int getPort() {
+                    return instanceSpec.getPort();
+                }
+            });
+        }
+        return instances;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void shutdown() throws RpcException {
+        logger.info("The ZookeeperRegistryCenter is stopping...");
+        List<RpcException> exceptions = new 
ArrayList<>(this.zookeeperServers.size());
+        for (TestingServer testingServer : this.zookeeperServers) {
+            try {
+                testingServer.close();
+                logger.info(String.format("The zookeeper instance of %s is 
shutdown successfully",
+                    testingServer.getConnectString()));
+            } catch (IOException exception) {
+                RpcException rpcException = new 
RpcException(String.format("Failed to close zookeeper instance of %s",
+                    testingServer.getConnectString()),
+                    exception);
+                exceptions.add(rpcException);
+                logger.error(rpcException);
+            }
+        }
+        this.instanceSpecs.clear();
+        this.zookeeperServers.clear();
+        if (!exceptions.isEmpty()) {
+            logger.info("The ZookeeperRegistryCenter failed to close.");
+            // throw any one of exceptions
+            throw exceptions.get(0);
+        } else {
+            logger.info("The ZookeeperRegistryCenter close successfully.");
+        }
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/SingleRegistryCenter.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperSingleRegistryCenter.java
similarity index 60%
rename from 
dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/SingleRegistryCenter.java
rename to 
dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperSingleRegistryCenter.java
index c5befdb..ffc0ec3 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/SingleRegistryCenter.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registrycenter/ZookeeperSingleRegistryCenter.java
@@ -16,15 +16,29 @@
  */
 package org.apache.dubbo.config.spring.registrycenter;
 
-import org.apache.dubbo.config.RegistryConfig;
-
 /**
- * Mock single registry center.
+ * The default zookeeper single registry center.
  */
-public interface SingleRegistryCenter extends RegistryCenter {
+public class ZookeeperSingleRegistryCenter extends ZookeeperRegistryCenter {
+
+    /**
+     * Initialize {@link ZookeeperSingleRegistryCenter} instance.
+     */
+    public ZookeeperSingleRegistryCenter() {
+        this(DEFAULT_PORT);
+    }
+
+    /**
+     * Initialize {@link RegistryCenter} instance.
+     *
+     * @param port the zookeeper server's port.
+     */
+    public ZookeeperSingleRegistryCenter(int port) {
+        super(port);
+    }
 
     /**
-     * Returns {@link RegistryConfig} instance.
+     * The zookeeper server's default port.
      */
-    RegistryConfig getRegistryConfig();
+    private static final int DEFAULT_PORT = 2181;
 }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java
index 04c9161..0e48137 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java
@@ -23,8 +23,8 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
 import org.apache.dubbo.config.context.ConfigManager;
 import org.apache.dubbo.config.spring.ServiceBean;
 import org.apache.dubbo.config.spring.api.DemoService;
-import 
org.apache.dubbo.config.spring.registrycenter.DefaultSingleRegistryCenter;
-import org.apache.dubbo.config.spring.registrycenter.SingleRegistryCenter;
+import 
org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
+import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
 import org.apache.dubbo.rpc.service.GenericService;
 import org.junit.jupiter.api.*;
 import org.junit.jupiter.api.extension.ExtendWith;
@@ -44,11 +44,11 @@ import static 
org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER
 @ImportResource(locations = 
"classpath:/META-INF/spring/dubbo-generic-consumer.xml")
 public class GenericServiceTest {
 
-    private static SingleRegistryCenter singleRegistryCenter;
+    private static RegistryCenter singleRegistryCenter;
 
     @BeforeAll
     public static void beforeAll() {
-        singleRegistryCenter = new DefaultSingleRegistryCenter();
+        singleRegistryCenter = new ZookeeperSingleRegistryCenter();
         singleRegistryCenter.startup();
         DubboBootstrap.reset();
     }

Reply via email to