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

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit bf0b2fc1d37cbcc3430454db16b74dea47e1c84c
Author: liubao <[email protected]>
AuthorDate: Mon Oct 9 12:03:19 2023 +0800

    [SCB-2008]priority property adapter
---
 .../rest/RestProducerInvocationCreatorTest.java    |   4 +-
 .../common/rest/TestRestEngineSchemaListener.java  |   4 +-
 .../rest/definition/TestRestOperationMeta.java     |   4 +-
 .../filter/inner/RestServerCodecFilterTest.java    |   2 +-
 .../common/rest/locator/TestMicroservicePaths.java |   2 +-
 .../rest/locator/TestServicePathManager.java       |   4 +-
 .../servicecomb/core/bootstrap/SCBBootstrap.java   |   5 +-
 .../core/bootstrap/SCBEngineForTest.java           |   6 +-
 .../core/TestSCBApplicationListener.java           |   2 +-
 .../filter/impl/ParameterValidatorFilterTest.java  |   3 +-
 .../servicecomb/config/cc/ConfigCenterConfig.java  |  14 --
 .../config/nacos/NacosDynamicPropertiesSource.java |   5 -
 foundations/foundation-config/pom.xml              |   4 -
 .../org/apache/servicecomb/config/ConfigUtil.java  |  16 ++
 .../config/DynamicConfigurationExt.java            |  34 ----
 .../config/DynamicWatchedConfigurationExt.java     |  75 -------
 .../config/FoundationConfigConfiguration.java      |   4 +-
 .../config/priority/ConfigObjectFactory.java       |   6 +-
 .../config/priority/ConfigObjectProperty.java      |   1 +
 .../config/priority/DynamicProperty.java           |  58 ++++++
 .../config/priority/PriorityProperty.java          |  11 +-
 .../config/priority/PriorityPropertyFactory.java   |  38 +---
 .../config/priority/PriorityPropertyManager.java   |  33 ++--
 .../config/inject/TestConfigObjectFactory.java     | 217 ++++++++++++++-------
 .../config/priority/TestPriorityProperty.java      | 147 +++++++-------
 .../config/priority/TestPriorityPropertyBase.java  |  17 +-
 .../registry/config/ConfigurePropertyUtils.java    |  55 ------
 .../servicecomb/loadbalance/Configuration.java     |   4 +-
 .../loadbalance/TestLoadBalanceFilter.java         |   2 +-
 .../TestInstancePropertyDiscoveryFilter.java       |  62 +++---
 .../TestAuthenticationBootListener.java            |   3 +-
 .../tracing/zipkin/ZipkinTracingFilter.java        |   3 -
 .../pojo/reference/PojoReferenceMetaTest.java      |   6 +-
 .../pojo/reference/TestRpcReferenceProcessor.java  |   6 +-
 .../highway/HighwayServerCodecFilterTest.java      |   3 +-
 .../transport/rest/servlet/TestRestServlet.java    |   2 +-
 .../rest/vertx/TestRestServerVerticle.java         |   2 +-
 .../rest/vertx/TestVertxRestDispatcher.java        |   2 +-
 38 files changed, 405 insertions(+), 461 deletions(-)

diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/RestProducerInvocationCreatorTest.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/RestProducerInvocationCreatorTest.java
index ea326b912..cc62f4c2e 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/RestProducerInvocationCreatorTest.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/RestProducerInvocationCreatorTest.java
@@ -82,9 +82,9 @@ public class RestProducerInvocationCreatorTest {
 
   @BeforeAll
   public static void beforeClass() {
-    engine = SCBBootstrap.createSCBEngineForTest();
-    engine.setStatus(SCBStatus.UP);
     Environment environment = Mockito.mock(Environment.class);
+    engine = SCBBootstrap.createSCBEngineForTest(environment);
+    engine.setStatus(SCBStatus.UP);
     LegacyPropertyFactory.setEnvironment(environment);
     
Mockito.when(environment.getProperty("servicecomb.rest.parameter.decodeAsObject",
 boolean.class, false))
         .thenReturn(false);
diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestRestEngineSchemaListener.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestRestEngineSchemaListener.java
index 4f782eeb9..43f452a14 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestRestEngineSchemaListener.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestRestEngineSchemaListener.java
@@ -47,12 +47,12 @@ public class TestRestEngineSchemaListener {
 
   @BeforeAll
   public static void setup() {
-    scbEngine = SCBBootstrap.createSCBEngineForTest();
+    Environment environment = Mockito.mock(Environment.class);
+    scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
     ExecutorManager executorManager = Mockito.mock(ExecutorManager.class);
     TransportManager transportManager = Mockito.mock(TransportManager.class);
     scbEngine.setTransportManager(transportManager);
     scbEngine.setExecutorManager(executorManager);
-    Environment environment = Mockito.mock(Environment.class);
     scbEngine.setEnvironment(environment);
     LegacyPropertyFactory.setEnvironment(environment);
     
Mockito.when(environment.getProperty("servicecomb.rest.parameter.decodeAsObject",
 boolean.class, false))
diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java
index b9fc9372a..7df112fcd 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/definition/TestRestOperationMeta.java
@@ -166,12 +166,12 @@ public class TestRestOperationMeta {
 
   @BeforeAll
   public static void classSetup() {
-    scbEngine = SCBBootstrap.createSCBEngineForTest();
+    Environment environment = Mockito.mock(Environment.class);
+    scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
     ExecutorManager executorManager = Mockito.mock(ExecutorManager.class);
     TransportManager transportManager = Mockito.mock(TransportManager.class);
     scbEngine.setTransportManager(transportManager);
     scbEngine.setExecutorManager(executorManager);
-    Environment environment = Mockito.mock(Environment.class);
     scbEngine.setEnvironment(environment);
     Mockito.when(environment.getProperty(CFG_KEY_TURN_DOWN_STATUS_WAIT_SEC,
         long.class, 
DEFAULT_TURN_DOWN_STATUS_WAIT_SEC)).thenReturn(DEFAULT_TURN_DOWN_STATUS_WAIT_SEC);
diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/inner/RestServerCodecFilterTest.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/inner/RestServerCodecFilterTest.java
index 8da1fa350..41f4826fc 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/inner/RestServerCodecFilterTest.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/inner/RestServerCodecFilterTest.java
@@ -97,8 +97,8 @@ public class RestServerCodecFilterTest {
 
   @BeforeAll
   public static void beforeClass() {
-    engine = SCBBootstrap.createSCBEngineForTest();
     Environment environment = Mockito.mock(Environment.class);
+    engine = SCBBootstrap.createSCBEngineForTest(environment);
     engine.setEnvironment(environment);
     Mockito.when(environment.getProperty(CFG_KEY_TURN_DOWN_STATUS_WAIT_SEC,
         long.class, 
DEFAULT_TURN_DOWN_STATUS_WAIT_SEC)).thenReturn(DEFAULT_TURN_DOWN_STATUS_WAIT_SEC);
diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/locator/TestMicroservicePaths.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/locator/TestMicroservicePaths.java
index e1d53e7f5..95538da15 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/locator/TestMicroservicePaths.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/locator/TestMicroservicePaths.java
@@ -46,8 +46,8 @@ public class TestMicroservicePaths {
 
   @BeforeAll
   public static void setup() {
-    scbEngine = SCBBootstrap.createSCBEngineForTest();
     Environment environment = Mockito.mock(Environment.class);
+    scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
     LegacyPropertyFactory.setEnvironment(environment);
     scbEngine.setEnvironment(environment);
     Mockito.when(environment.getProperty(CFG_KEY_TURN_DOWN_STATUS_WAIT_SEC,
diff --git 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/locator/TestServicePathManager.java
 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/locator/TestServicePathManager.java
index 47b3ecb53..b6fe098c3 100644
--- 
a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/locator/TestServicePathManager.java
+++ 
b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/locator/TestServicePathManager.java
@@ -65,8 +65,8 @@ public class TestServicePathManager {
 
   @Test
   public void testBuildProducerPathsNoPrefix() {
-    scbEngine = SCBBootstrap.createSCBEngineForTest();
     Environment environment = Mockito.mock(Environment.class);
+    scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
     scbEngine.setEnvironment(environment);
     Mockito.when(environment.getProperty(CFG_KEY_TURN_DOWN_STATUS_WAIT_SEC,
         long.class, 
DEFAULT_TURN_DOWN_STATUS_WAIT_SEC)).thenReturn(DEFAULT_TURN_DOWN_STATUS_WAIT_SEC);
@@ -90,8 +90,8 @@ public class TestServicePathManager {
   @Test
   public void testBuildProducerPathsHasPrefix() {
     
ClassLoaderScopeContext.setClassLoaderScopeProperty(DefinitionConst.URL_PREFIX, 
"/root/rest");
-    scbEngine = SCBBootstrap.createSCBEngineForTest();
     Environment environment = Mockito.mock(Environment.class);
+    scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
     scbEngine.setEnvironment(environment);
     Mockito.when(environment.getProperty(CFG_KEY_TURN_DOWN_STATUS_WAIT_SEC,
         long.class, 
DEFAULT_TURN_DOWN_STATUS_WAIT_SEC)).thenReturn(DEFAULT_TURN_DOWN_STATUS_WAIT_SEC);
diff --git 
a/core/src/main/java/org/apache/servicecomb/core/bootstrap/SCBBootstrap.java 
b/core/src/main/java/org/apache/servicecomb/core/bootstrap/SCBBootstrap.java
index 395760160..14a6c65b8 100644
--- a/core/src/main/java/org/apache/servicecomb/core/bootstrap/SCBBootstrap.java
+++ b/core/src/main/java/org/apache/servicecomb/core/bootstrap/SCBBootstrap.java
@@ -26,9 +26,10 @@ import 
org.apache.servicecomb.core.transport.TransportManager;
 import org.apache.servicecomb.registry.DiscoveryManager;
 import org.apache.servicecomb.registry.RegistrationManager;
 import org.apache.servicecomb.registry.discovery.TelnetInstancePing;
+import org.springframework.core.env.Environment;
 
 public class SCBBootstrap {
-  public static SCBEngine createSCBEngineForTest() {
+  public static SCBEngine createSCBEngineForTest(Environment environment) {
     RegistrationManager registrationManager = new 
RegistrationManager(Collections.emptyList());
     DiscoveryManager discoveryManager = new 
DiscoveryManager(Collections.emptyList(),
         List.of(new TelnetInstancePing()));
@@ -39,7 +40,7 @@ public class SCBBootstrap {
     microserviceProperties.setName("test");
     microserviceProperties.setVersion("0.0.1");
 
-    SCBEngine result = new SCBEngineForTest();
+    SCBEngine result = new SCBEngineForTest(environment);
     result.setDiscoveryManager(discoveryManager);
     result.setRegistrationManager(registrationManager);
     result.setBootListeners(Collections.emptyList());
diff --git 
a/core/src/main/java/org/apache/servicecomb/core/bootstrap/SCBEngineForTest.java
 
b/core/src/main/java/org/apache/servicecomb/core/bootstrap/SCBEngineForTest.java
index 36eb26dc7..48d3fe01d 100644
--- 
a/core/src/main/java/org/apache/servicecomb/core/bootstrap/SCBEngineForTest.java
+++ 
b/core/src/main/java/org/apache/servicecomb/core/bootstrap/SCBEngineForTest.java
@@ -30,21 +30,23 @@ import org.apache.servicecomb.core.filter.impl.EmptyFilter;
 import org.apache.servicecomb.foundation.common.event.EventManager;
 import org.apache.servicecomb.foundation.common.event.SimpleEventBus;
 import org.apache.servicecomb.foundation.common.utils.ReflectUtils;
+import org.springframework.core.env.Environment;
 
 /**
  * not depend on remote service registry and spring context
  */
 public class SCBEngineForTest extends SCBEngine {
-  public SCBEngineForTest() {
+  public SCBEngineForTest(Environment environment) {
     List<Filter> filters = Arrays.asList(
         new EmptyFilter()
     );
     setFilterChainsManager(new FilterChainsManager()
         .addFilters(filters));
 
-    PriorityPropertyFactory propertyFactory = new PriorityPropertyFactory();
+    PriorityPropertyFactory propertyFactory = new 
PriorityPropertyFactory(environment);
     ConfigObjectFactory configObjectFactory = new 
ConfigObjectFactory(propertyFactory);
     setPriorityPropertyManager(new 
PriorityPropertyManager(configObjectFactory));
+    setEnvironment(environment);
   }
 
   @Override
diff --git 
a/core/src/test/java/org/apache/servicecomb/core/TestSCBApplicationListener.java
 
b/core/src/test/java/org/apache/servicecomb/core/TestSCBApplicationListener.java
index c6aad1f9d..99690c3c3 100644
--- 
a/core/src/test/java/org/apache/servicecomb/core/TestSCBApplicationListener.java
+++ 
b/core/src/test/java/org/apache/servicecomb/core/TestSCBApplicationListener.java
@@ -40,8 +40,8 @@ public class TestSCBApplicationListener {
   @Test
   public void onApplicationEvent_close() {
     ContextClosedEvent contextClosedEvent = 
Mockito.mock(ContextClosedEvent.class);
-    SCBEngine scbEngine = SCBBootstrap.createSCBEngineForTest();
     Environment environment = Mockito.mock(Environment.class);
+    SCBEngine scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
     scbEngine.setEnvironment(environment);
     Mockito.when(environment.getProperty(CFG_KEY_TURN_DOWN_STATUS_WAIT_SEC,
         long.class, 
DEFAULT_TURN_DOWN_STATUS_WAIT_SEC)).thenReturn(DEFAULT_TURN_DOWN_STATUS_WAIT_SEC);
diff --git 
a/core/src/test/java/org/apache/servicecomb/core/filter/impl/ParameterValidatorFilterTest.java
 
b/core/src/test/java/org/apache/servicecomb/core/filter/impl/ParameterValidatorFilterTest.java
index 5d441ef26..f80490978 100644
--- 
a/core/src/test/java/org/apache/servicecomb/core/filter/impl/ParameterValidatorFilterTest.java
+++ 
b/core/src/test/java/org/apache/servicecomb/core/filter/impl/ParameterValidatorFilterTest.java
@@ -100,8 +100,9 @@ public class ParameterValidatorFilterTest {
 
   @Before
   public void setUp() throws Exception {
-    SCBEngine engine = SCBBootstrap.createSCBEngineForTest();
     environment = Mockito.mock(Environment.class);
+    SCBEngine engine = SCBBootstrap.createSCBEngineForTest(environment);
+
     Mockito.when(environment.getProperty(ENABLE_EL, boolean.class, 
false)).thenReturn(false);
     filter.setEnvironment(environment);
     filter.afterPropertiesSet();
diff --git 
a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterConfig.java
 
b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterConfig.java
index 3476bb2e6..eaa047e98 100644
--- 
a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterConfig.java
+++ 
b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterConfig.java
@@ -24,31 +24,21 @@ import org.apache.servicecomb.config.ConfigUtil;
 import org.apache.servicecomb.foundation.vertx.VertxConst;
 import org.springframework.core.env.Environment;
 
-import com.netflix.config.ConcurrentCompositeConfiguration;
-
 public final class ConfigCenterConfig {
   public static final String SSL_TAG = "cc.consumer";
 
-  private static ConcurrentCompositeConfiguration finalConfig;
-
-  private static final String AUTO_DISCOVERY_ENABLED = 
"servicecomb.service.registry.autodiscovery";
-
   private static final String ADDRESS = "servicecomb.config.client.serverUri";
 
   private static final String DOMAIN_NAME = 
"servicecomb.config.client.domainName";
 
   private static final String REFRESH_INTERVAL = 
"servicecomb.config.client.refresh_interval";
 
-  private static final String FIRST_REFRESH_INTERVAL = 
"servicecomb.config.client.first_refresh_interval";
-
   private static final String FIRST_PULL_REQUIRED = 
"servicecomb.config.client.firstPullRequired";
 
   public static final String FILE_SOURCE = 
"servicecomb.config.client.fileSource";
 
   private static final int DEFAULT_REFRESH_INTERVAL = 15000;
 
-  private static final int DEFAULT_FIRST_REFRESH_INTERVAL = 0;
-
   private final Environment environment;
 
   public ConfigCenterConfig(Environment environment) {
@@ -73,10 +63,6 @@ public final class ConfigCenterConfig {
         REFRESH_INTERVAL, long.class, (long) DEFAULT_REFRESH_INTERVAL);
   }
 
-  public int getFirstRefreshInterval() {
-    return environment.getProperty(FIRST_REFRESH_INTERVAL, int.class, 
DEFAULT_FIRST_REFRESH_INTERVAL);
-  }
-
   public Boolean isProxyEnable() {
     return environment.getProperty(VertxConst.PROXY_ENABLE, boolean.class, 
false);
   }
diff --git 
a/dynamic-config/config-nacos/src/main/java/org/apache/servicecomb/config/nacos/NacosDynamicPropertiesSource.java
 
b/dynamic-config/config-nacos/src/main/java/org/apache/servicecomb/config/nacos/NacosDynamicPropertiesSource.java
index 4b39760a9..bb6d32780 100644
--- 
a/dynamic-config/config-nacos/src/main/java/org/apache/servicecomb/config/nacos/NacosDynamicPropertiesSource.java
+++ 
b/dynamic-config/config-nacos/src/main/java/org/apache/servicecomb/config/nacos/NacosDynamicPropertiesSource.java
@@ -20,10 +20,8 @@ import static 
org.apache.servicecomb.config.nacos.ConfigurationAction.CREATE;
 import static org.apache.servicecomb.config.nacos.ConfigurationAction.DELETE;
 import static org.apache.servicecomb.config.nacos.ConfigurationAction.SET;
 
-import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.apache.servicecomb.config.ConfigMapping;
 import org.apache.servicecomb.config.DynamicPropertiesSource;
@@ -34,7 +32,6 @@ import org.springframework.core.env.Environment;
 import org.springframework.core.env.MapPropertySource;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.netflix.config.WatchedUpdateListener;
 
 public class NacosDynamicPropertiesSource implements 
DynamicPropertiesSource<Map<String, Object>> {
   public static final String SOURCE_NAME = "kie";
@@ -43,8 +40,6 @@ public class NacosDynamicPropertiesSource implements 
DynamicPropertiesSource<Map
 
   private final Map<String, Object> valueCache = new ConcurrentHashMap<>();
 
-  private final List<WatchedUpdateListener> listeners = new 
CopyOnWriteArrayList<>();
-
   public NacosDynamicPropertiesSource() {
   }
 
diff --git a/foundations/foundation-config/pom.xml 
b/foundations/foundation-config/pom.xml
index b609a9630..f79b84d72 100644
--- a/foundations/foundation-config/pom.xml
+++ b/foundations/foundation-config/pom.xml
@@ -43,10 +43,6 @@
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-autoconfigure</artifactId>
     </dependency>
-    <dependency>
-      <groupId>com.netflix.archaius</groupId>
-      <artifactId>archaius-core</artifactId>
-    </dependency>
     <dependency>
       <groupId>commons-configuration</groupId>
       <artifactId>commons-configuration</artifactId>
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
index 4259badfc..73dc2348a 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
@@ -17,8 +17,10 @@
 
 package org.apache.servicecomb.config;
 
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.configuration.PropertyConverter;
@@ -48,4 +50,18 @@ public final class ConfigUtil {
     }
     return result;
   }
+
+  public static Map<String, String> stringPropertiesWithPrefix(Environment 
environment, String prefix) {
+    Map<String, String> result = new HashMap<>();
+    for (PropertySource<?> propertySource : ((ConfigurableEnvironment) 
environment).getPropertySources()) {
+      if (propertySource instanceof EnumerablePropertySource) {
+        for (String key : ((EnumerablePropertySource<?>) 
propertySource).getPropertyNames()) {
+          if (key.startsWith(prefix)) {
+            result.put(key, environment.getProperty(key));
+          }
+        }
+      }
+    }
+    return result;
+  }
 }
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicConfigurationExt.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicConfigurationExt.java
deleted file mode 100644
index a89e89bf2..000000000
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicConfigurationExt.java
+++ /dev/null
@@ -1,34 +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.servicecomb.config;
-
-import com.netflix.config.AbstractPollingScheduler;
-import com.netflix.config.DynamicConfiguration;
-import com.netflix.config.PolledConfigurationSource;
-
-/**
- * Disable delimiter parsing for string
- */
-@SuppressWarnings("unchecked")
-public class DynamicConfigurationExt extends DynamicConfiguration {
-  public DynamicConfigurationExt(PolledConfigurationSource source, 
AbstractPollingScheduler scheduler) {
-    super();
-    setDelimiterParsingDisabled(true);
-    startPolling(source, scheduler);
-  }
-}
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicWatchedConfigurationExt.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicWatchedConfigurationExt.java
deleted file mode 100644
index 0aa3b0491..000000000
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicWatchedConfigurationExt.java
+++ /dev/null
@@ -1,75 +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.servicecomb.config;
-
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.netflix.config.ConcurrentMapConfiguration;
-import com.netflix.config.DynamicPropertyUpdater;
-import com.netflix.config.DynamicWatchedConfiguration;
-import com.netflix.config.WatchedConfigurationSource;
-import com.netflix.config.WatchedUpdateListener;
-import com.netflix.config.WatchedUpdateResult;
-
-/**
- * Same as DynamicWatchedConfiguration but Disable delimiter parsing for string
- *
- * @see DynamicWatchedConfiguration
- */
-@SuppressWarnings("unchecked")
-public class DynamicWatchedConfigurationExt extends ConcurrentMapConfiguration 
implements WatchedUpdateListener {
-
-  private final boolean ignoreDeletesFromSource;
-
-  private final DynamicPropertyUpdater updater;
-
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(DynamicWatchedConfigurationExt.class);
-
-  private DynamicWatchedConfigurationExt(WatchedConfigurationSource source, 
boolean ignoreDeletesFromSource,
-      DynamicPropertyUpdater updater) {
-    this.ignoreDeletesFromSource = ignoreDeletesFromSource;
-    this.updater = updater;
-
-    setDelimiterParsingDisabled(true);
-
-    // get a current snapshot of the config source data
-    try {
-      Map<String, Object> currentData = source.getCurrentData();
-      WatchedUpdateResult result = WatchedUpdateResult.createFull(currentData);
-
-      updateConfiguration(result);
-    } catch (final Exception exc) {
-      LOGGER.error("could not getCurrentData() from the 
WatchedConfigurationSource", exc);
-    }
-
-    // add a listener for subsequent config updates
-    source.addUpdateListener(this);
-  }
-
-  public DynamicWatchedConfigurationExt(final WatchedConfigurationSource 
source) {
-    this(source, false, new DynamicPropertyUpdater());
-  }
-
-  @Override
-  public void updateConfiguration(final WatchedUpdateResult result) {
-    updater.updateProperties(result, this, ignoreDeletesFromSource);
-  }
-}
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/FoundationConfigConfiguration.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/FoundationConfigConfiguration.java
index 18906749f..a89cd16a4 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/FoundationConfigConfiguration.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/FoundationConfigConfiguration.java
@@ -40,8 +40,8 @@ public class FoundationConfigConfiguration {
   }
 
   @Bean
-  public PriorityPropertyFactory priorityPropertyFactory() {
-    return new PriorityPropertyFactory();
+  public PriorityPropertyFactory priorityPropertyFactory(Environment 
environment) {
+    return new PriorityPropertyFactory(environment);
   }
 
   @Bean
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectFactory.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectFactory.java
index c5b9cf855..ff18b827e 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectFactory.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectFactory.java
@@ -44,11 +44,11 @@ import com.fasterxml.jackson.databind.type.TypeFactory;
 public class ConfigObjectFactory {
   private final PriorityPropertyFactory propertyFactory;
 
-  private static final Map<Class<?>, JavaType> classCache = new 
ConcurrentHashMapEx<>();
+  private final Map<Class<?>, JavaType> classCache = new 
ConcurrentHashMapEx<>();
 
-  private static final Map<JavaType, BeanDescription> javaTypeCache = new 
ConcurrentHashMapEx<>();
+  private final Map<JavaType, BeanDescription> javaTypeCache = new 
ConcurrentHashMapEx<>();
 
-  private static final Map<BeanPropertyDefinition, Setter<Object, Object>> 
beanDescriptionCache = new ConcurrentHashMapEx<>();
+  private final Map<BeanPropertyDefinition, Setter<Object, Object>> 
beanDescriptionCache = new ConcurrentHashMapEx<>();
 
   public ConfigObjectFactory(PriorityPropertyFactory propertyFactory) {
     this.propertyFactory = propertyFactory;
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectProperty.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectProperty.java
index e81465b0f..b575ec33c 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectProperty.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/ConfigObjectProperty.java
@@ -36,6 +36,7 @@ public class ConfigObjectProperty {
 
   public void updateValueWhenChanged(Object instance, @Nullable String 
changedKey) {
     if (property.isChangedKey(changedKey)) {
+      property.updateValue();
       setter.set(instance, property.getValue());
     }
   }
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/DynamicProperty.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/DynamicProperty.java
new file mode 100644
index 000000000..48588b6ec
--- /dev/null
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/DynamicProperty.java
@@ -0,0 +1,58 @@
+/*
+ * 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.servicecomb.config.priority;
+
+import org.springframework.core.env.Environment;
+
+public class DynamicProperty {
+  private final Environment environment;
+
+  private final String propName;
+
+  public DynamicProperty(Environment environment, String propName) {
+    this.environment = environment;
+    this.propName = propName;
+  }
+
+  public Integer getInteger() {
+    return environment.getProperty(propName, Integer.class);
+  }
+
+  public Long getLong() {
+    return environment.getProperty(propName, Long.class);
+  }
+
+  public String getString() {
+    return environment.getProperty(propName);
+  }
+
+  public Boolean getBoolean() {
+    return environment.getProperty(propName, Boolean.class);
+  }
+
+  public Double getDouble() {
+    return environment.getProperty(propName, Double.class);
+  }
+
+  public Float getFloat() {
+    return environment.getProperty(propName, Float.class);
+  }
+
+  public String getName() {
+    return propName;
+  }
+}
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityProperty.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityProperty.java
index 3d03267ae..7ebbcfd8d 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityProperty.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityProperty.java
@@ -23,8 +23,7 @@ import java.util.function.Function;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import com.netflix.config.DynamicProperty;
+import org.springframework.core.env.Environment;
 
 /**
  * must create by PriorityPropertyManager<br>
@@ -44,19 +43,19 @@ public class PriorityProperty<T> {
 
   private T finalValue;
 
-  public PriorityProperty(PriorityPropertyType<T> propertyType) {
+  public PriorityProperty(Environment environment, PriorityPropertyType<T> 
propertyType) {
     this.propertyType = propertyType;
     this.joinedPriorityKeys = Arrays.toString(propertyType.getPriorityKeys());
     this.internalValueReader = collectReader(propertyType.getType());
-    this.properties = createProperties(propertyType.getPriorityKeys());
+    this.properties = createProperties(environment, 
propertyType.getPriorityKeys());
     initValue();
   }
 
-  private DynamicProperty[] createProperties(String[] priorityKeys) {
+  private DynamicProperty[] createProperties(Environment environment, String[] 
priorityKeys) {
     DynamicProperty[] properties = new DynamicProperty[priorityKeys.length];
     for (int idx = 0; idx < priorityKeys.length; idx++) {
       String key = priorityKeys[idx].trim();
-      properties[idx] = DynamicProperty.getInstance(key);
+      properties[idx] = new DynamicProperty(environment, key);
     }
     return properties;
   }
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityPropertyFactory.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityPropertyFactory.java
index 92ead1599..abd43f8d4 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityPropertyFactory.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityPropertyFactory.java
@@ -21,51 +21,29 @@ import java.lang.reflect.Type;
 import java.util.Map;
 import java.util.stream.Stream;
 
-import jakarta.annotation.PreDestroy;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.apache.commons.configuration.event.ConfigurationEvent;
-import org.apache.commons.configuration.event.ConfigurationListener;
 import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import org.springframework.core.env.Environment;
 
-import com.netflix.config.ConfigurationManager;
+import com.google.common.annotations.VisibleForTesting;
 
 public class PriorityPropertyFactory {
-  private final AbstractConfiguration configuration;
-
-  private final ConfigurationListener configurationListener = 
this::configurationListener;
-
-  // same to com.netflix.config.DynamicProperty.ALL_PROPS
-  // the set is finite
-  // will not cause OOM exception
   private final Map<PriorityPropertyType<?>, PriorityProperty<?>> properties = 
new ConcurrentHashMapEx<>();
 
-  public PriorityPropertyFactory() {
-    this.configuration = ConfigurationManager.getConfigInstance();
-    this.configuration.addConfigurationListener(configurationListener);
-  }
+  private final Environment environment;
 
-  @PreDestroy
-  public void onDestroy() {
-    this.configuration.removeConfigurationListener(configurationListener);
+  public PriorityPropertyFactory(Environment environment) {
+    this.environment = environment;
   }
 
+  @VisibleForTesting
   public Stream<PriorityProperty<?>> getProperties() {
     return properties.values().stream();
   }
 
-  private void configurationListener(ConfigurationEvent event) {
-    if (event.isBeforeUpdate()) {
-      return;
-    }
-
-    // just update all properties, it's very fast, no need to do any optimize
-    getProperties().forEach(PriorityProperty::updateValue);
-  }
-
   @SuppressWarnings("unchecked")
   public <T> PriorityProperty<T> getOrCreate(Type type, T invalidValue, T 
defaultValue, String... priorityKeys) {
     PriorityPropertyType<T> propertyType = new PriorityPropertyType<>(type, 
invalidValue, defaultValue, priorityKeys);
-    return (PriorityProperty<T>) properties.computeIfAbsent(propertyType, 
PriorityProperty::new);
+    return (PriorityProperty<T>) properties.computeIfAbsent(propertyType,
+        key -> new PriorityProperty<>(environment, key));
   }
 }
diff --git 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityPropertyManager.java
 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityPropertyManager.java
index 95b37a037..8ed1e7dea 100644
--- 
a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityPropertyManager.java
+++ 
b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/priority/PriorityPropertyManager.java
@@ -24,18 +24,13 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.WeakHashMap;
 
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.apache.commons.configuration.event.ConfigurationEvent;
-import org.apache.commons.configuration.event.ConfigurationListener;
+import org.apache.servicecomb.config.ConfigurationChangedEvent;
+import org.apache.servicecomb.foundation.common.event.EventManager;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.netflix.config.ConfigurationManager;
+import com.google.common.eventbus.Subscribe;
 
 public class PriorityPropertyManager {
-  private final AbstractConfiguration configuration;
-
-  private final ConfigurationListener configurationListener = 
this::configurationListener;
-
   private final ConfigObjectFactory configObjectFactory;
 
   // key is config object instance
@@ -43,10 +38,8 @@ public class PriorityPropertyManager {
   private final Map<Object, List<ConfigObjectProperty>> configObjectMap = 
synchronizedMap(new WeakHashMap<>());
 
   public PriorityPropertyManager(ConfigObjectFactory configObjectFactory) {
-    this.configuration = ConfigurationManager.getConfigInstance();
-    this.configuration.addConfigurationListener(configurationListener);
-
     this.configObjectFactory = configObjectFactory;
+    EventManager.register(this);
   }
 
   public PriorityPropertyFactory getPropertyFactory() {
@@ -54,20 +47,20 @@ public class PriorityPropertyManager {
   }
 
   public void close() {
-    configuration.removeConfigurationListener(configurationListener);
-  }
 
-  public synchronized void configurationListener(ConfigurationEvent event) {
-    if (event.isBeforeUpdate()) {
-      return;
-    }
+  }
 
+  @Subscribe
+  public void onConfigurationChangedEvent(ConfigurationChangedEvent event) {
     // just loop all properties, it's very fast, no need to do any optimize
     for (Entry<Object, List<ConfigObjectProperty>> entry : 
configObjectMap.entrySet()) {
       Object instance = entry.getKey();
-      entry.getValue()
-          .forEach(
-              configObjectProperty -> 
configObjectProperty.updateValueWhenChanged(instance, event.getPropertyName()));
+      entry.getValue().forEach(
+          configObjectProperty -> {
+            for (String updatedKey : event.getChanged()) {
+              configObjectProperty.updateValueWhenChanged(instance, 
updatedKey);
+            }
+          });
     }
   }
 
diff --git 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/inject/TestConfigObjectFactory.java
 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/inject/TestConfigObjectFactory.java
index ec9412898..9e5915b0c 100644
--- 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/inject/TestConfigObjectFactory.java
+++ 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/inject/TestConfigObjectFactory.java
@@ -17,11 +17,15 @@
 package org.apache.servicecomb.config.inject;
 
 import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
 
+import org.apache.servicecomb.config.ConfigurationChangedEvent;
 import org.apache.servicecomb.config.priority.TestPriorityPropertyBase;
-import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
+import org.apache.servicecomb.foundation.common.event.EventManager;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
 
 public class TestConfigObjectFactory extends TestPriorityPropertyBase {
   public static class ConfigNoAnnotation {
@@ -193,33 +197,33 @@ public class TestConfigObjectFactory extends 
TestPriorityPropertyBase {
 
   @Test
   public void noAnnotation_initValue() {
-    ArchaiusUtils.setProperty("strValue", "strValue");
-    ArchaiusUtils.setProperty("strValue1", "strValue1");
-
-    ArchaiusUtils.setProperty("intValue", 1);
-    ArchaiusUtils.setProperty("intValue1", 2);
-    ArchaiusUtils.setProperty("intValueObj", 3);
-    ArchaiusUtils.setProperty("intValueObj1", 4);
-
-    ArchaiusUtils.setProperty("longValue", 5);
-    ArchaiusUtils.setProperty("longValue1", 6);
-    ArchaiusUtils.setProperty("longValueObj", 7);
-    ArchaiusUtils.setProperty("longValueObj1", 8);
-
-    ArchaiusUtils.setProperty("floatValue", 9.0);
-    ArchaiusUtils.setProperty("floatValue1", 10.0);
-    ArchaiusUtils.setProperty("floatValueObj", 11.0);
-    ArchaiusUtils.setProperty("floatValueObj1", 12.0);
-
-    ArchaiusUtils.setProperty("doubleValue", 13.0);
-    ArchaiusUtils.setProperty("doubleValue1", 14.0);
-    ArchaiusUtils.setProperty("doubleValueObj", 15.0);
-    ArchaiusUtils.setProperty("doubleValueObj1", 16.0);
-
-    ArchaiusUtils.setProperty("booleanValue", true);
-    ArchaiusUtils.setProperty("booleanValue1", true);
-    ArchaiusUtils.setProperty("booleanValueObj", true);
-    ArchaiusUtils.setProperty("booleanValueObj1", true);
+    Mockito.when(environment.getProperty("strValue")).thenReturn("strValue");
+    Mockito.when(environment.getProperty("strValue1")).thenReturn("strValue1");
+
+    Mockito.when(environment.getProperty("intValue", 
Integer.class)).thenReturn(1);
+    Mockito.when(environment.getProperty("intValue1", 
Integer.class)).thenReturn(2);
+    Mockito.when(environment.getProperty("intValueObj", 
Integer.class)).thenReturn(3);
+    Mockito.when(environment.getProperty("intValueObj1", 
Integer.class)).thenReturn(4);
+
+    Mockito.when(environment.getProperty("longValue", 
Long.class)).thenReturn(5L);
+    Mockito.when(environment.getProperty("longValue1", 
Long.class)).thenReturn(6L);
+    Mockito.when(environment.getProperty("longValueObj", 
Long.class)).thenReturn(7L);
+    Mockito.when(environment.getProperty("longValueObj1", 
Long.class)).thenReturn(8L);
+
+    Mockito.when(environment.getProperty("floatValue", 
Float.class)).thenReturn(9.0F);
+    Mockito.when(environment.getProperty("floatValue1", 
Float.class)).thenReturn(10.0F);
+    Mockito.when(environment.getProperty("floatValueObj", 
Float.class)).thenReturn(11.0F);
+    Mockito.when(environment.getProperty("floatValueObj1", 
Float.class)).thenReturn(12.0F);
+
+    Mockito.when(environment.getProperty("doubleValue", 
Double.class)).thenReturn(13.0D);
+    Mockito.when(environment.getProperty("doubleValue1", 
Double.class)).thenReturn(14.0D);
+    Mockito.when(environment.getProperty("doubleValueObj", 
Double.class)).thenReturn(15.0D);
+    Mockito.when(environment.getProperty("doubleValueObj1", 
Double.class)).thenReturn(16.0D);
+
+    Mockito.when(environment.getProperty("booleanValue", 
Boolean.class)).thenReturn(true);
+    Mockito.when(environment.getProperty("booleanValue1", 
Boolean.class)).thenReturn(true);
+    Mockito.when(environment.getProperty("booleanValueObj", 
Boolean.class)).thenReturn(true);
+    Mockito.when(environment.getProperty("booleanValueObj1", 
Boolean.class)).thenReturn(true);
 
     ConfigNoAnnotation config = 
priorityPropertyManager.createConfigObject(ConfigNoAnnotation.class);
 
@@ -256,33 +260,64 @@ public class TestConfigObjectFactory extends 
TestPriorityPropertyBase {
   public void noAnnotation_updateValue() {
     ConfigNoAnnotation config = 
priorityPropertyManager.createConfigObject(ConfigNoAnnotation.class);
 
-    ArchaiusUtils.setProperty("strValue", "strValue");
-    ArchaiusUtils.setProperty("strValue1", "strValue1");
-
-    ArchaiusUtils.setProperty("intValue", 1);
-    ArchaiusUtils.setProperty("intValue1", 2);
-    ArchaiusUtils.setProperty("intValueObj", 3);
-    ArchaiusUtils.setProperty("intValueObj1", 4);
-
-    ArchaiusUtils.setProperty("longValue", 5);
-    ArchaiusUtils.setProperty("longValue1", 6);
-    ArchaiusUtils.setProperty("longValueObj", 7);
-    ArchaiusUtils.setProperty("longValueObj1", 8);
-
-    ArchaiusUtils.setProperty("floatValue", 9.0);
-    ArchaiusUtils.setProperty("floatValue1", 10.0);
-    ArchaiusUtils.setProperty("floatValueObj", 11.0);
-    ArchaiusUtils.setProperty("floatValueObj1", 12.0);
-
-    ArchaiusUtils.setProperty("doubleValue", 13.0);
-    ArchaiusUtils.setProperty("doubleValue1", 14.0);
-    ArchaiusUtils.setProperty("doubleValueObj", 15.0);
-    ArchaiusUtils.setProperty("doubleValueObj1", 16.0);
-
-    ArchaiusUtils.setProperty("booleanValue", true);
-    ArchaiusUtils.setProperty("booleanValue1", true);
-    ArchaiusUtils.setProperty("booleanValueObj", true);
-    ArchaiusUtils.setProperty("booleanValueObj1", true);
+    Mockito.when(environment.getProperty("strValue")).thenReturn("strValue");
+    Mockito.when(environment.getProperty("strValue1")).thenReturn("strValue1");
+
+    Mockito.when(environment.getProperty("intValue", 
Integer.class)).thenReturn(1);
+    Mockito.when(environment.getProperty("intValue1", 
Integer.class)).thenReturn(2);
+    Mockito.when(environment.getProperty("intValueObj", 
Integer.class)).thenReturn(3);
+    Mockito.when(environment.getProperty("intValueObj1", 
Integer.class)).thenReturn(4);
+
+    Mockito.when(environment.getProperty("longValue", 
Long.class)).thenReturn(5L);
+    Mockito.when(environment.getProperty("longValue1", 
Long.class)).thenReturn(6L);
+    Mockito.when(environment.getProperty("longValueObj", 
Long.class)).thenReturn(7L);
+    Mockito.when(environment.getProperty("longValueObj1", 
Long.class)).thenReturn(8L);
+
+    Mockito.when(environment.getProperty("floatValue", 
Float.class)).thenReturn(9.0F);
+    Mockito.when(environment.getProperty("floatValue1", 
Float.class)).thenReturn(10.0F);
+    Mockito.when(environment.getProperty("floatValueObj", 
Float.class)).thenReturn(11.0F);
+    Mockito.when(environment.getProperty("floatValueObj1", 
Float.class)).thenReturn(12.0F);
+
+    Mockito.when(environment.getProperty("doubleValue", 
Double.class)).thenReturn(13.0D);
+    Mockito.when(environment.getProperty("doubleValue1", 
Double.class)).thenReturn(14.0D);
+    Mockito.when(environment.getProperty("doubleValueObj", 
Double.class)).thenReturn(15.0D);
+    Mockito.when(environment.getProperty("doubleValueObj1", 
Double.class)).thenReturn(16.0D);
+
+    Mockito.when(environment.getProperty("booleanValue", 
Boolean.class)).thenReturn(true);
+    Mockito.when(environment.getProperty("booleanValue1", 
Boolean.class)).thenReturn(true);
+    Mockito.when(environment.getProperty("booleanValueObj", 
Boolean.class)).thenReturn(true);
+    Mockito.when(environment.getProperty("booleanValueObj1", 
Boolean.class)).thenReturn(true);
+
+    HashMap<String, Object> updated = new HashMap<>();
+    updated.put("strValue", "strValue");
+    updated.put("strValue1", "strValue1");
+
+    updated.put("intValue", 0);
+    updated.put("intValue1", 1);
+    updated.put("intValueObj", 2);
+    updated.put("intValueObj1", 3);
+
+    updated.put("longValue", 5L);
+    updated.put("longValue1", 6L);
+    updated.put("longValueObj", 7L);
+    updated.put("longValueObj1", 8L);
+
+    updated.put("floatValue", 9.0F);
+    updated.put("floatValue1", 10.0F);
+    updated.put("floatValueObj", 11.0F);
+    updated.put("floatValueObj1", 12.0F);
+
+    updated.put("doubleValue", 13.0D);
+    updated.put("doubleValue1", 14.0D);
+    updated.put("doubleValueObj", 15.0D);
+    updated.put("doubleValueObj1", 16.0D);
+
+    updated.put("booleanValue", true);
+    updated.put("booleanValue1", true);
+    updated.put("booleanValueObj", true);
+    updated.put("booleanValueObj1", true);
+
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
 
     Assertions.assertEquals("strValue", config.strValue);
     Assertions.assertEquals("strValue1", config.getStrValue1());
@@ -370,16 +405,29 @@ public class TestConfigObjectFactory extends 
TestPriorityPropertyBase {
 
     Assertions.assertEquals(0, config.longValue);
 
-    ArchaiusUtils.setProperty("root.low-2.a.high-2.b", Long.MAX_VALUE);
+    Mockito.when(environment.getProperty("root.low-2.a.high-2.b", 
Long.class)).thenReturn(Long.MAX_VALUE);
+    HashMap<String, Object> updated = new HashMap<>();
+    updated.put("root.low-2.a.high-2.b", Long.MAX_VALUE);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
     Assertions.assertEquals(Long.MAX_VALUE, config.longValue);
 
-    ArchaiusUtils.setProperty("root.low-2.a.high-1.b", Long.MAX_VALUE - 1);
+    Mockito.when(environment.getProperty("root.low-2.a.high-1.b", 
Long.class)).thenReturn(Long.MAX_VALUE - 1);
+    updated = new HashMap<>();
+    updated.put("root.low-2.a.high-1.b", Long.MAX_VALUE - 1);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
+
     Assertions.assertEquals(Long.MAX_VALUE - 1, config.longValue);
 
-    ArchaiusUtils.setProperty("root.low-1.a.high-2.b", Long.MAX_VALUE - 2);
+    Mockito.when(environment.getProperty("root.low-1.a.high-2.b", 
Long.class)).thenReturn(Long.MAX_VALUE - 2);
+    updated = new HashMap<>();
+    updated.put("root.low-1.a.high-2.b", Long.MAX_VALUE - 2);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
     Assertions.assertEquals(Long.MAX_VALUE - 2, config.longValue);
 
-    ArchaiusUtils.setProperty("root.low-1.a.high-1.b", Long.MAX_VALUE - 3);
+    Mockito.when(environment.getProperty("root.low-1.a.high-1.b", 
Long.class)).thenReturn(Long.MAX_VALUE - 3);
+    updated = new HashMap<>();
+    updated.put("root.low-1.a.high-1.b", Long.MAX_VALUE - 3);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
     Assertions.assertEquals(Long.MAX_VALUE - 3, config.longValue);
   }
 
@@ -390,11 +438,19 @@ public class TestConfigObjectFactory extends 
TestPriorityPropertyBase {
 
     Assertions.assertEquals(0, config.floatValue, 0);
 
-    ArchaiusUtils.setProperty("root.l1-2", String.valueOf(1f));
-    Assertions.assertEquals(1f, config.floatValue, 0);
+    Mockito.when(environment.getProperty("root.l1-2", 
Float.class)).thenReturn(1F);
+    HashMap<String, Object> updated = new HashMap<>();
+    updated.put("root.l1-2", 1F);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
+
+    Assertions.assertEquals(1F, config.floatValue, 0);
+
+    Mockito.when(environment.getProperty("root.l1-1", 
Float.class)).thenReturn(2F);
+    updated = new HashMap<>();
+    updated.put("root.l1-1", 2F);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
 
-    ArchaiusUtils.setProperty("root.l1-1", String.valueOf(2f));
-    Assertions.assertEquals(2f, config.floatValue, 0);
+    Assertions.assertEquals(2F, config.floatValue, 0);
   }
 
   @Test
@@ -403,7 +459,10 @@ public class TestConfigObjectFactory extends 
TestPriorityPropertyBase {
 
     Assertions.assertEquals(0, config.intValue);
 
-    ArchaiusUtils.setProperty("root.k.value", "1");
+    Mockito.when(environment.getProperty("root.k.value", 
Integer.class)).thenReturn(1);
+    Map<String, Object> updated = new HashMap<>();
+    updated.put("root.k.value", 1);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
     Assertions.assertEquals(1, config.intValue);
   }
 
@@ -411,16 +470,28 @@ public class TestConfigObjectFactory extends 
TestPriorityPropertyBase {
   public void overridePrefix() {
     ConfigWithAnnotation config = 
priorityPropertyManager.createConfigObject(ConfigWithAnnotation.class);
 
-    ArchaiusUtils.setProperty("override.high", "high");
+    Mockito.when(environment.getProperty("override.high")).thenReturn("high");
+    HashMap<String, Object> updated = new HashMap<>();
+    updated.put("override.high", "high");
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
     Assertions.assertEquals("high", config.strValue);
 
-    ArchaiusUtils.setProperty("override.high", null);
+    Mockito.when(environment.getProperty("override.high")).thenReturn(null);
+    updated = new HashMap<>();
+    updated.put("override.high", null);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
     Assertions.assertNull(config.strValue);
 
-    ArchaiusUtils.setProperty("override.low", "low");
+    Mockito.when(environment.getProperty("override.low")).thenReturn("low");
+    updated = new HashMap<>();
+    updated.put("override.low", "low");
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
     Assertions.assertEquals("low", config.strValue);
 
-    ArchaiusUtils.setProperty("override.low", null);
+    Mockito.when(environment.getProperty("override.low")).thenReturn(null);
+    updated = new HashMap<>();
+    updated.put("override.low", null);
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
     Assertions.assertNull(config.strValue);
   }
 
@@ -447,8 +518,14 @@ public class TestConfigObjectFactory extends 
TestPriorityPropertyBase {
 
     Assertions.assertEquals(4, config.index);
     Assertions.assertEquals("h", config.model.name);
-    ArchaiusUtils.setProperty("root.index", "5");
-    ArchaiusUtils.setProperty("root.model.name", "w");
+
+    Mockito.when(environment.getProperty("root.index", 
Integer.class)).thenReturn(5);
+    Mockito.when(environment.getProperty("root.model.name")).thenReturn("w");
+    Map<String, Object> updated = new HashMap<>();
+    updated.put("root.index", 5);
+    updated.put("root.model.name", "w");
+    EventManager.post(ConfigurationChangedEvent.createIncremental(updated));
+
     Assertions.assertEquals(5, config.index);
     Assertions.assertEquals("w", config.model.name);
   }
diff --git 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/priority/TestPriorityProperty.java
 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/priority/TestPriorityProperty.java
index 4448a313d..85b3185d2 100644
--- 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/priority/TestPriorityProperty.java
+++ 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/priority/TestPriorityProperty.java
@@ -16,15 +16,9 @@
  */
 package org.apache.servicecomb.config.priority;
 
-import java.util.Collections;
-
-import org.apache.commons.configuration.MapConfiguration;
-import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-
-import com.netflix.config.ConcurrentCompositeConfiguration;
-import com.netflix.config.DynamicPropertyFactory;
+import org.mockito.Mockito;
 
 public class TestPriorityProperty extends TestPriorityPropertyBase {
   String high = "ms.schema.op";
@@ -40,26 +34,26 @@ public class TestPriorityProperty extends 
TestPriorityPropertyBase {
     PriorityProperty<Long> config = propertyFactory.getOrCreate(Long.class, 
-1L, -2L, keys);
     Assertions.assertEquals(-2L, (long) config.getValue());
 
-    ArchaiusUtils.setProperty(low, 1L);
+    updateLong(low, 1L, config);
     Assertions.assertEquals(1L, (long) config.getValue());
 
-    ArchaiusUtils.setProperty(middle, 2L);
+    updateLong(middle, 2L, config);
     Assertions.assertEquals(2L, (long) config.getValue());
 
-    ArchaiusUtils.setProperty(high, 3L);
+    updateLong(high, 3L, config);
     Assertions.assertEquals(3L, (long) config.getValue());
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateLong(middle, null, config);
     Assertions.assertEquals(3L, (long) config.getValue());
-    ArchaiusUtils.setProperty(middle, 2L);
 
-    ArchaiusUtils.setProperty(high, null);
+    updateLong(middle, 2L, config);
+    updateLong(high, null, config);
     Assertions.assertEquals(2L, (long) config.getValue());
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateLong(middle, null, config);
     Assertions.assertEquals(1L, (long) config.getValue());
 
-    ArchaiusUtils.setProperty(low, null);
+    updateLong(low, null, config);
     Assertions.assertEquals(-2L, (long) config.getValue());
   }
 
@@ -68,54 +62,84 @@ public class TestPriorityProperty extends 
TestPriorityPropertyBase {
     PriorityProperty<Integer> config = 
propertyFactory.getOrCreate(Integer.class, -1, -2, keys);
     Assertions.assertEquals(-2L, (int) config.getValue());
 
-    ArchaiusUtils.setProperty(low, 1);
+    updateInt(low, 1, config);
     Assertions.assertEquals(1, (int) config.getValue());
 
-    ArchaiusUtils.setProperty(middle, 2);
+    updateInt(middle, 2, config);
     Assertions.assertEquals(2, (int) config.getValue());
 
-    ArchaiusUtils.setProperty(high, 3);
+    updateInt(high, 3, config);
     Assertions.assertEquals(3, (int) config.getValue());
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateInt(middle, null, config);
     Assertions.assertEquals(3, (int) config.getValue());
-    ArchaiusUtils.setProperty(middle, 2);
+    updateInt(middle, 2, config);
 
-    ArchaiusUtils.setProperty(high, null);
+    updateInt(high, null, config);
     Assertions.assertEquals(2, (int) config.getValue());
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateInt(middle, null, config);
     Assertions.assertEquals(1, (int) config.getValue());
 
-    ArchaiusUtils.setProperty(low, null);
+    updateInt(low, null, config);
     Assertions.assertEquals(-2, (int) config.getValue());
   }
 
+  private void updateFloat(String key, Float value, PriorityProperty<Float> 
config) {
+    Mockito.when(environment.getProperty(key, Float.class)).thenReturn(value);
+    config.updateValue();
+  }
+
+  private void updateStr(String key, String value, PriorityProperty<String> 
config) {
+    Mockito.when(environment.getProperty(key)).thenReturn(value);
+    config.updateValue();
+  }
+
+  private void updateInt(String key, Integer value, PriorityProperty<Integer> 
config) {
+    Mockito.when(environment.getProperty(key, 
Integer.class)).thenReturn(value);
+    config.updateValue();
+  }
+
+  private void updateLong(String key, Long value, PriorityProperty<Long> 
config) {
+    Mockito.when(environment.getProperty(key, Long.class)).thenReturn(value);
+    config.updateValue();
+  }
+
+  private void updateBoolean(String key, Boolean value, 
PriorityProperty<Boolean> config) {
+    Mockito.when(environment.getProperty(key, 
Boolean.class)).thenReturn(value);
+    config.updateValue();
+  }
+
+  private void updateDouble(String key, Double value, PriorityProperty<Double> 
config) {
+    Mockito.when(environment.getProperty(key, Double.class)).thenReturn(value);
+    config.updateValue();
+  }
+
   @Test
   public void testString() {
     PriorityProperty<String> config = 
propertyFactory.getOrCreate(String.class, null, "def", keys);
     Assertions.assertEquals("def", config.getValue());
 
-    ArchaiusUtils.setProperty(low, 1);
+    updateStr(low, "1", config);
     Assertions.assertEquals("1", config.getValue());
 
-    ArchaiusUtils.setProperty(middle, 2);
+    updateStr(middle, "2", config);
     Assertions.assertEquals("2", config.getValue());
 
-    ArchaiusUtils.setProperty(high, 3);
+    updateStr(high, "3", config);
     Assertions.assertEquals("3", config.getValue());
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateStr(middle, null, config);
     Assertions.assertEquals("3", config.getValue());
-    ArchaiusUtils.setProperty(middle, 2);
 
-    ArchaiusUtils.setProperty(high, null);
+    updateStr(middle, "2", config);
+    updateStr(high, null, config);
     Assertions.assertEquals("2", config.getValue());
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateStr(middle, null, config);
     Assertions.assertEquals("1", config.getValue());
 
-    ArchaiusUtils.setProperty(low, null);
+    updateStr(low, null, config);
     Assertions.assertEquals("def", config.getValue());
   }
 
@@ -124,26 +148,26 @@ public class TestPriorityProperty extends 
TestPriorityPropertyBase {
     PriorityProperty<Boolean> config = 
propertyFactory.getOrCreate(Boolean.class, null, false, keys);
     Assertions.assertFalse(config.getValue());
 
-    ArchaiusUtils.setProperty(low, true);
+    updateBoolean(low, true, config);
     Assertions.assertTrue(config.getValue());
 
-    ArchaiusUtils.setProperty(middle, false);
+    updateBoolean(middle, false, config);
     Assertions.assertFalse(config.getValue());
 
-    ArchaiusUtils.setProperty(high, true);
+    updateBoolean(high, true, config);
     Assertions.assertTrue(config.getValue());
 
-    ArchaiusUtils.setProperty(middle, false);
+    updateBoolean(middle, false, config);
     Assertions.assertTrue(config.getValue());
-    ArchaiusUtils.setProperty(middle, false);
 
-    ArchaiusUtils.setProperty(high, null);
+    updateBoolean(middle, false, config);
+    updateBoolean(high, null, config);
     Assertions.assertFalse(config.getValue());
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateBoolean(middle, null, config);
     Assertions.assertTrue(config.getValue());
 
-    ArchaiusUtils.setProperty(low, null);
+    updateBoolean(low, null, config);
     Assertions.assertFalse(config.getValue());
   }
 
@@ -152,26 +176,26 @@ public class TestPriorityProperty extends 
TestPriorityPropertyBase {
     PriorityProperty<Double> config = 
propertyFactory.getOrCreate(Double.class, null, -2.0, keys);
     Assertions.assertEquals(-2, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(low, 1);
+    updateDouble(low, 1D, config);
     Assertions.assertEquals(1, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(middle, 2);
+    updateDouble(middle, 2D, config);
     Assertions.assertEquals(2, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(high, 3);
+    updateDouble(high, 3D, config);
     Assertions.assertEquals(3, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateDouble(middle, null, config);
     Assertions.assertEquals(3, config.getValue(), 0);
-    ArchaiusUtils.setProperty(middle, 2);
 
-    ArchaiusUtils.setProperty(high, null);
+    updateDouble(middle, 2D, config);
+    updateDouble(high, null, config);
     Assertions.assertEquals(2, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateDouble(middle, null, config);
     Assertions.assertEquals(1, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(low, null);
+    updateDouble(low, null, config);
     Assertions.assertEquals(-2, config.getValue(), 0);
   }
 
@@ -180,39 +204,26 @@ public class TestPriorityProperty extends 
TestPriorityPropertyBase {
     PriorityProperty<Float> config = propertyFactory.getOrCreate(Float.class, 
null, -2.0f, keys);
     Assertions.assertEquals(-2, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(low, 1);
+    updateFloat(low, 1F, config);
     Assertions.assertEquals(1, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(middle, 2);
+    updateFloat(middle, 2F, config);
     Assertions.assertEquals(2, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(high, 3);
+    updateFloat(high, 3F, config);
     Assertions.assertEquals(3, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateFloat(middle, null, config);
     Assertions.assertEquals(3, config.getValue(), 0);
-    ArchaiusUtils.setProperty(middle, 2);
 
-    ArchaiusUtils.setProperty(high, null);
+    updateFloat(middle, 2F, config);
+    updateFloat(high, null, config);
     Assertions.assertEquals(2, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(middle, null);
+    updateFloat(middle, null, config);
     Assertions.assertEquals(1, config.getValue(), 0);
 
-    ArchaiusUtils.setProperty(low, null);
+    updateFloat(low, null, config);
     Assertions.assertEquals(-2, config.getValue(), 0);
   }
-
-  @Test
-  public void globalRefresh() {
-    PriorityProperty<String> property = 
propertyFactory.getOrCreate(String.class, null, null, keys);
-
-    Assertions.assertNull(property.getValue());
-
-    ConcurrentCompositeConfiguration config = 
(ConcurrentCompositeConfiguration) DynamicPropertyFactory
-        .getBackingConfigurationSource();
-    config.addConfiguration(new 
MapConfiguration(Collections.singletonMap(high, "high-value")));
-
-    Assertions.assertEquals("high-value", property.getValue());
-  }
 }
diff --git 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/priority/TestPriorityPropertyBase.java
 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/priority/TestPriorityPropertyBase.java
index 1b2d5f450..375a755ec 100644
--- 
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/priority/TestPriorityPropertyBase.java
+++ 
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/priority/TestPriorityPropertyBase.java
@@ -16,17 +16,12 @@
  */
 package org.apache.servicecomb.config.priority;
 
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.config.Configurator;
 import org.apache.servicecomb.foundation.common.LegacyPropertyFactory;
-import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.mockito.Mockito;
 import org.springframework.core.env.Environment;
 
-import com.netflix.config.DynamicPropertyFactory;
-
 public class TestPriorityPropertyBase {
   protected PriorityPropertyManager priorityPropertyManager;
 
@@ -36,24 +31,14 @@ public class TestPriorityPropertyBase {
 
   @BeforeEach
   public void setup() {
-    // avoid write too many logs
-    Configurator.setRootLevel(Level.OFF);
-
     environment = Mockito.mock(Environment.class);
     LegacyPropertyFactory.setEnvironment(environment);
 
-    // make sure create a DynamicPropertyFactory instance
-    // otherwise will cause wrong order of configurationListeners
-    DynamicPropertyFactory.getInstance();
-
-    propertyFactory = new PriorityPropertyFactory();
+    propertyFactory = new PriorityPropertyFactory(environment);
     priorityPropertyManager = new PriorityPropertyManager(new 
ConfigObjectFactory(propertyFactory));
-
-    Configurator.setRootLevel(Level.INFO);
   }
 
   @AfterEach
   public void teardown() {
-    ArchaiusUtils.resetConfig();
   }
 }
diff --git 
a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/config/ConfigurePropertyUtils.java
 
b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/config/ConfigurePropertyUtils.java
deleted file mode 100644
index ad9004d73..000000000
--- 
a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/config/ConfigurePropertyUtils.java
+++ /dev/null
@@ -1,55 +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.servicecomb.registry.config;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.commons.configuration.Configuration;
-
-import com.netflix.config.DynamicPropertyFactory;
-
-public final class ConfigurePropertyUtils {
-  private ConfigurePropertyUtils() {
-  }
-
-  /**
-   * 获取key包含prefix前缀的所有配置项
-   */
-  public static Map<String, String> getPropertiesWithPrefix(String prefix) {
-    Object config = DynamicPropertyFactory.getBackingConfigurationSource();
-    if (!Configuration.class.isInstance(config)) {
-      return new HashMap<>();
-    }
-
-    return getPropertiesWithPrefix((Configuration) config, prefix);
-  }
-
-  // caller ensure configuration is valid
-  public static Map<String, String> getPropertiesWithPrefix(Configuration 
configuration, String prefix) {
-    Map<String, String> propertiesMap = new HashMap<>();
-
-    Iterator<String> keysIterator = configuration.getKeys(prefix);
-    while (keysIterator.hasNext()) {
-      String key = keysIterator.next();
-      propertiesMap.put(key.substring(prefix.length() + 1), 
String.valueOf(configuration.getProperty(key)));
-    }
-    return propertiesMap;
-  }
-}
diff --git 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
index 47226c0b0..61f7a2eee 100644
--- 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
+++ 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
@@ -19,8 +19,8 @@ package org.apache.servicecomb.loadbalance;
 
 import java.util.Map;
 
+import org.apache.servicecomb.config.ConfigUtil;
 import org.apache.servicecomb.foundation.common.LegacyPropertyFactory;
-import org.apache.servicecomb.registry.config.ConfigurePropertyUtils;
 
 /**
  * configuration items
@@ -188,7 +188,7 @@ public final class Configuration {
 
   public Map<String, String> getFlowsplitFilterOptions(String microservice) {
     String keyPrefix = 
String.format(TRANSACTIONCONTROL_OPTIONS_PREFIX_PATTERN, microservice);
-    return ConfigurePropertyUtils.getPropertiesWithPrefix(keyPrefix);
+    return 
ConfigUtil.stringPropertiesWithPrefix(LegacyPropertyFactory.getEnvironment(), 
keyPrefix);
   }
 
   public static String getStringProperty(String defaultValue, String... keys) {
diff --git 
a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceFilter.java
 
b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceFilter.java
index a03c0e4dd..e7a0c0687 100644
--- 
a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceFilter.java
+++ 
b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceFilter.java
@@ -73,8 +73,8 @@ public class TestLoadBalanceFilter {
 
   @Before
   public void setUp() {
-    scbEngine = SCBBootstrap.createSCBEngineForTest();
     Environment environment = Mockito.mock(Environment.class);
+    scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
     scbEngine.setEnvironment(environment);
     Mockito.when(environment.getProperty(CFG_KEY_TURN_DOWN_STATUS_WAIT_SEC,
         long.class, 
DEFAULT_TURN_DOWN_STATUS_WAIT_SEC)).thenReturn(DEFAULT_TURN_DOWN_STATUS_WAIT_SEC);
diff --git 
a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/TestInstancePropertyDiscoveryFilter.java
 
b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/TestInstancePropertyDiscoveryFilter.java
index b2902682e..0c498d25d 100644
--- 
a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/TestInstancePropertyDiscoveryFilter.java
+++ 
b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/TestInstancePropertyDiscoveryFilter.java
@@ -22,21 +22,19 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.foundation.common.LegacyPropertyFactory;
 import org.apache.servicecomb.registry.api.DiscoveryInstance;
 import org.apache.servicecomb.registry.discovery.DiscoveryContext;
 import org.apache.servicecomb.registry.discovery.DiscoveryTreeNode;
 import org.apache.servicecomb.registry.discovery.StatefulDiscoveryInstance;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
-
-import mockit.Expectations;
-import mockit.Injectable;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.EnumerablePropertySource;
+import org.springframework.core.env.MutablePropertySources;
 
 public class TestInstancePropertyDiscoveryFilter {
 
@@ -44,16 +42,27 @@ public class TestInstancePropertyDiscoveryFilter {
 
   StatefulDiscoveryInstance instance;
 
-  @BeforeClass
-  public static void beforeCls() {
-    AbstractConfiguration configuration = new BaseConfiguration();
-    
configuration.addProperty("servicecomb.loadbalance.test.flowsplitFilter.policy",
-        "org.apache.servicecomb.loadbalance.filter.SimpleFlowsplitFilter");
-    
configuration.addProperty("servicecomb.loadbalance.test.flowsplitFilter.options.tag0",
 "value0");
-  }
+  ConfigurableEnvironment environment;
+
+  EnumerablePropertySource<?> propertySource;
 
-  @Before
+  @BeforeEach
   public void setUp() {
+    environment = Mockito.mock(ConfigurableEnvironment.class);
+    LegacyPropertyFactory.setEnvironment(environment);
+    propertySource = Mockito.mock(EnumerablePropertySource.class);
+    MutablePropertySources mutablePropertySources = new 
MutablePropertySources();
+    mutablePropertySources.addLast(propertySource);
+    
Mockito.when(environment.getPropertySources()).thenReturn(mutablePropertySources);
+    Mockito.when(propertySource.getPropertyNames()).thenReturn(new String[] {
+        "servicecomb.loadbalance.test.flowsplitFilter.policy",
+        "servicecomb.loadbalance.test.flowsplitFilter.options.tag0"
+    });
+    
Mockito.when(environment.getProperty("servicecomb.loadbalance.test.flowsplitFilter.policy"))
+        
.thenReturn("org.apache.servicecomb.loadbalance.filter.SimpleFlowsplitFilter");
+    
Mockito.when(environment.getProperty("servicecomb.loadbalance.test.flowsplitFilter.options.tag0"))
+        .thenReturn("value0");
+
     filter = new InstancePropertyDiscoveryFilter();
     Map<String, String> properties = new HashMap<>();
     properties.put("tag0", "value0");
@@ -82,20 +91,17 @@ public class TestInstancePropertyDiscoveryFilter {
 
   @Test
   @SuppressWarnings("unchecked")
-  public void testGetFilteredListOfServers(@Injectable DiscoveryContext 
context, @Injectable DiscoveryTreeNode parent,
-      @Injectable Invocation invocation) {
+  public void testGetFilteredListOfServers() {
+    DiscoveryContext context = new DiscoveryContext();
+    DiscoveryTreeNode parent = new DiscoveryTreeNode();
+
+    Invocation invocation = Mockito.mock(Invocation.class);
+    context.setInputParameters(invocation);
+
     List<StatefulDiscoveryInstance> instances = new ArrayList<>();
     instances.add(instance);
-    new Expectations() {
-      {
-        context.getInputParameters();
-        result = invocation;
-        parent.data();
-        result = instances;
-        parent.name();
-        result = "parent";
-      }
-    };
+    parent.data(instances);
+    parent.name("parent");
 
     DiscoveryTreeNode node = filter.discovery(context, parent);
     Assertions.assertEquals(1, ((List<StatefulDiscoveryInstance>) 
node.data()).size());
diff --git 
a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestAuthenticationBootListener.java
 
b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestAuthenticationBootListener.java
index a2be179f5..ca222f5b6 100644
--- 
a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestAuthenticationBootListener.java
+++ 
b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestAuthenticationBootListener.java
@@ -58,8 +58,7 @@ public class TestAuthenticationBootListener {
 
   @BeforeEach
   public void setUp() {
-    engine = SCBBootstrap.createSCBEngineForTest();
-    engine.setEnvironment(environment);
+    engine = SCBBootstrap.createSCBEngineForTest(environment);
     engine.run();
   }
 
diff --git 
a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java
 
b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java
index 2f67b4b64..b7c62e442 100644
--- 
a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java
+++ 
b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java
@@ -21,8 +21,6 @@ import static 
org.apache.servicecomb.swagger.invocation.InvocationType.PROVIDER;
 
 import java.util.concurrent.CompletableFuture;
 
-import javax.annotation.Nonnull;
-
 import org.apache.servicecomb.core.Invocation;
 import org.apache.servicecomb.core.exception.Exceptions;
 import org.apache.servicecomb.core.filter.Filter;
@@ -41,7 +39,6 @@ public class ZipkinTracingFilter implements Filter {
 
   private ZipkinProviderDelegate producer;
 
-  @Nonnull
   @Override
   public String getName() {
     return NAME;
diff --git 
a/providers/provider-pojo/src/test/java/org/apache/servicecomb/provider/pojo/reference/PojoReferenceMetaTest.java
 
b/providers/provider-pojo/src/test/java/org/apache/servicecomb/provider/pojo/reference/PojoReferenceMetaTest.java
index 98ba2de92..1ecf03156 100644
--- 
a/providers/provider-pojo/src/test/java/org/apache/servicecomb/provider/pojo/reference/PojoReferenceMetaTest.java
+++ 
b/providers/provider-pojo/src/test/java/org/apache/servicecomb/provider/pojo/reference/PojoReferenceMetaTest.java
@@ -28,8 +28,12 @@ import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.springframework.core.env.Environment;
 
 public class PojoReferenceMetaTest {
+  static Environment environment = Mockito.mock(Environment.class);
+
   @BeforeEach
   public void setUp() {
   }
@@ -40,7 +44,7 @@ public class PojoReferenceMetaTest {
 
   @Test
   public void testHasConsumerInterface() {
-    SCBEngine scbEngine = SCBBootstrap.createSCBEngineForTest();
+    SCBEngine scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
 
     PojoReferenceMeta pojoReferenceMeta = new PojoReferenceMeta();
     pojoReferenceMeta.setMicroserviceName("test");
diff --git 
a/providers/provider-pojo/src/test/java/org/apache/servicecomb/provider/pojo/reference/TestRpcReferenceProcessor.java
 
b/providers/provider-pojo/src/test/java/org/apache/servicecomb/provider/pojo/reference/TestRpcReferenceProcessor.java
index b20c3785b..0c3754148 100644
--- 
a/providers/provider-pojo/src/test/java/org/apache/servicecomb/provider/pojo/reference/TestRpcReferenceProcessor.java
+++ 
b/providers/provider-pojo/src/test/java/org/apache/servicecomb/provider/pojo/reference/TestRpcReferenceProcessor.java
@@ -26,8 +26,12 @@ import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.springframework.core.env.Environment;
 
 public class TestRpcReferenceProcessor {
+  static Environment environment = Mockito.mock(Environment.class);
+
   RpcReferenceProcessor consumers = new RpcReferenceProcessor();
 
   @BeforeEach
@@ -46,7 +50,7 @@ public class TestRpcReferenceProcessor {
 
   @Test
   public void testReference() {
-    SCBEngine scbEngine = SCBBootstrap.createSCBEngineForTest();
+    SCBEngine scbEngine = SCBBootstrap.createSCBEngineForTest(environment);
 
     PersonReference bean = new PersonReference();
 
diff --git 
a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java
 
b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java
index ee159fc1e..8856cb79b 100644
--- 
a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java
+++ 
b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java
@@ -89,8 +89,7 @@ public class HighwayServerCodecFilterTest {
         .thenReturn(true);
     LegacyPropertyFactory.setEnvironment(environment);
 
-    engine = SCBBootstrap.createSCBEngineForTest();
-    engine.setEnvironment(environment);
+    engine = SCBBootstrap.createSCBEngineForTest(environment);
     engine.setStatus(SCBStatus.UP);
     invocation = InvocationFactory.forProvider(endpoint, operationMeta, null);
   }
diff --git 
a/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServlet.java
 
b/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServlet.java
index 3fe2094f4..168efb4d0 100644
--- 
a/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServlet.java
+++ 
b/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServlet.java
@@ -56,7 +56,7 @@ public class TestRestServlet {
     LegacyPropertyFactory.setEnvironment(environment);
     restservlet = new RestServlet();
 
-    SCBBootstrap.createSCBEngineForTest();
+    SCBBootstrap.createSCBEngineForTest(environment);
   }
 
   @After
diff --git 
a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestRestServerVerticle.java
 
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestRestServerVerticle.java
index d3b502a6d..3d3545a8e 100644
--- 
a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestRestServerVerticle.java
+++ 
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestRestServerVerticle.java
@@ -171,7 +171,7 @@ public class TestRestServerVerticle {
     instance = new RestServerVerticle();
     startPromise = Promise.promise();
 
-    SCBBootstrap.createSCBEngineForTest();
+    SCBBootstrap.createSCBEngineForTest(environment);
   }
 
   @After
diff --git 
a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestDispatcher.java
 
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestDispatcher.java
index aeab3878b..db5edd19f 100644
--- 
a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestDispatcher.java
+++ 
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestDispatcher.java
@@ -68,7 +68,7 @@ public class TestVertxRestDispatcher {
     dispatcher = new VertxRestDispatcher();
     dispatcher.init(mainRouter);
 
-    
SCBBootstrap.createSCBEngineForTest().setTransportManager(transportManager);
+    
SCBBootstrap.createSCBEngineForTest(environment).setTransportManager(transportManager);
   }
 
   @After

Reply via email to