[ 
https://issues.apache.org/jira/browse/SCB-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16708050#comment-16708050
 ] 

ASF GitHub Bot commented on SCB-1048:
-------------------------------------

liubao68 closed pull request #1014: [SCB-1048]Provide a way to configure 
bootstrap information in Cloud N…
URL: https://github.com/apache/servicecomb-java-chassis/pull/1014
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/coverage-reports/pom.xml b/coverage-reports/pom.xml
index 98285871b..04396fb0a 100644
--- a/coverage-reports/pom.xml
+++ b/coverage-reports/pom.xml
@@ -46,6 +46,10 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-config</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>deployment</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-vertx</artifactId>
diff --git a/deployment/README.md b/deployment/README.md
new file mode 100644
index 000000000..b2764cc0a
--- /dev/null
+++ b/deployment/README.md
@@ -0,0 +1,13 @@
+# About Deployment Module
+
+Deployment is a mechanism to manage how microservics interact with external 
services. When running a microservice in a Cloud Native environment, it will 
interact with many external services, like service center, config center, an 
APM service to report tracing data, a dashboard service to report health data, 
etc. Deployment Service manages the meta data of these services. Deployment 
queries the addresses , the parameters, the authentication information of these 
services and so on. 
+
+Deployment Service is some kind of service like service center, they are 
differ from two aspects:
+1. All microservics will report their information to service center. But 
Deployment Service acts as a management system and knows the meta information 
in deploy time. 
+2. Service center provide some other functions like instance management and 
heartbeat, while Deployment Service only provides metadata query services and 
it is simple. 
+
+This module does not provide a Deployment Service, it provides the interface 
to interacts with Deployment Service. Service providers can implement the 
interface. 
+
+They are some design constraints need to be considered when implement 
Deployment interface:
+1. Deployment can only read configurations of environment, microservics.yaml. 
It can not read dynamic configurations.
+2. Deployment is initialized before bean initialization. 
diff --git a/deployment/pom.xml b/deployment/pom.xml
new file mode 100644
index 000000000..6dc9c1446
--- /dev/null
+++ b/deployment/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <parent>
+    <groupId>org.apache.servicecomb</groupId>
+    <artifactId>java-chassis-parent</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>../parent</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>deployment</artifactId>
+  <name>Java Chassis::Deployment</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-config</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-vertx</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-common</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>io.vertx</groupId>
+      <artifactId>vertx-codegen</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-test-scaffolding</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git 
a/deployment/src/main/java/org/apache/servicecomb/deployment/DefaultDeploymentProvider.java
 
b/deployment/src/main/java/org/apache/servicecomb/deployment/DefaultDeploymentProvider.java
new file mode 100644
index 000000000..9099735b0
--- /dev/null
+++ 
b/deployment/src/main/java/org/apache/servicecomb/deployment/DefaultDeploymentProvider.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.deployment;
+
+import java.util.Arrays;
+
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.servicecomb.config.ConfigUtil;
+
+import com.google.common.annotations.VisibleForTesting;
+
+public class DefaultDeploymentProvider implements DeploymentProvider {
+  private static AbstractConfiguration configuration = 
ConfigUtil.createLocalConfig();
+
+  @Override
+  public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
+    switch (systemKey) {
+      case SYSTEM_KEY_SERVICE_CENTER:
+        SystemBootstrapInfo sc = new SystemBootstrapInfo();
+        String[] urls = 
configuration.getStringArray("servicecomb.service.registry.address");
+        if (urls == null || urls.length == 0) {
+          urls = new String[] {"https://127.0.0.1:30100"};
+        }
+        sc.setAccessURL(Arrays.asList(urls));
+        return sc;
+      case SYSTEM_KEY_CONFIG_CENTER:
+        String[] ccAddresses = 
configuration.getStringArray("servicecomb.config.client.serverUri");
+        if (ccAddresses == null || ccAddresses.length == 0) {
+          return null;
+        }
+        SystemBootstrapInfo cc = new SystemBootstrapInfo();
+        cc.setAccessURL(Arrays.asList(ccAddresses));
+        return cc;
+      default:
+        return null;
+    }
+  }
+
+  @VisibleForTesting
+  public static void setConfiguration(AbstractConfiguration configuration) {
+    DefaultDeploymentProvider.configuration = configuration;
+  }
+}
diff --git 
a/deployment/src/main/java/org/apache/servicecomb/deployment/Deployment.java 
b/deployment/src/main/java/org/apache/servicecomb/deployment/Deployment.java
new file mode 100644
index 000000000..f26980e54
--- /dev/null
+++ b/deployment/src/main/java/org/apache/servicecomb/deployment/Deployment.java
@@ -0,0 +1,35 @@
+/*
+ * 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.deployment;
+
+import java.util.List;
+
+import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
+
+public class Deployment {
+  private static List<DeploymentProvider> providerList = 
SPIServiceUtils.getSortedService(DeploymentProvider.class);
+
+  public static SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
+    for (DeploymentProvider provider : providerList) {
+      if (provider.getSystemBootStrapInfo(systemKey) != null) {
+        return provider.getSystemBootStrapInfo(systemKey);
+      }
+    }
+    return null;
+  }
+}
diff --git 
a/deployment/src/main/java/org/apache/servicecomb/deployment/DeploymentProvider.java
 
b/deployment/src/main/java/org/apache/servicecomb/deployment/DeploymentProvider.java
new file mode 100644
index 000000000..703af6ddb
--- /dev/null
+++ 
b/deployment/src/main/java/org/apache/servicecomb/deployment/DeploymentProvider.java
@@ -0,0 +1,29 @@
+/*
+ * 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.deployment;
+
+public interface DeploymentProvider {
+  String SYSTEM_KEY_SERVICE_CENTER = "ServiceCenter";
+  String SYSTEM_KEY_CONFIG_CENTER = "ConfigCenter";
+
+  default int getOrder() {
+    return 100;
+  }
+
+  SystemBootstrapInfo getSystemBootStrapInfo(String systemKey);
+}
diff --git 
a/deployment/src/main/java/org/apache/servicecomb/deployment/SystemBootstrapInfo.java
 
b/deployment/src/main/java/org/apache/servicecomb/deployment/SystemBootstrapInfo.java
new file mode 100644
index 000000000..c98f93e6a
--- /dev/null
+++ 
b/deployment/src/main/java/org/apache/servicecomb/deployment/SystemBootstrapInfo.java
@@ -0,0 +1,47 @@
+/*
+ * 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.deployment;
+
+import java.util.List;
+import java.util.Map;
+
+public class SystemBootstrapInfo {
+  private List<String> accessURL;
+
+  private Map<String, Object> properties;
+
+  public List<String> getAccessURL() {
+    return accessURL;
+  }
+
+  public void setAccessURL(List<String> accessURL) {
+    this.accessURL = accessURL;
+  }
+
+  public Map<String, Object> getProperties() {
+    return properties;
+  }
+
+  public void setProperties(Map<String, Object> properties) {
+    this.properties = properties;
+  }
+
+  public Object getProperty(String key) {
+    return properties.get(key);
+  }
+}
diff --git 
a/deployment/src/main/resources/META-INF/services/org.apache.servicecomb.deployment.DeploymentProvider
 
b/deployment/src/main/resources/META-INF/services/org.apache.servicecomb.deployment.DeploymentProvider
new file mode 100644
index 000000000..49e32f16a
--- /dev/null
+++ 
b/deployment/src/main/resources/META-INF/services/org.apache.servicecomb.deployment.DeploymentProvider
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.servicecomb.deployment.DefaultDeploymentProvider
diff --git 
a/deployment/src/test/java/org/apache/servicecomb/deployment/CustomDeploymentProvider.java
 
b/deployment/src/test/java/org/apache/servicecomb/deployment/CustomDeploymentProvider.java
new file mode 100644
index 000000000..df7e226b0
--- /dev/null
+++ 
b/deployment/src/test/java/org/apache/servicecomb/deployment/CustomDeploymentProvider.java
@@ -0,0 +1,39 @@
+/*
+ * 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.deployment;
+
+import java.util.Arrays;
+
+public class CustomDeploymentProvider implements DeploymentProvider {
+  @Override
+  public int getOrder() {
+    return 0;
+  }
+
+  @Override
+  public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
+    switch (systemKey) {
+      case DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER:
+        SystemBootstrapInfo cc = new SystemBootstrapInfo();
+        cc.setAccessURL(Arrays.asList("http://lcalhost/custom";));
+        return cc;
+      default:
+        return null;
+    }
+  }
+}
diff --git 
a/deployment/src/test/java/org/apache/servicecomb/deployment/TestDeployment.java
 
b/deployment/src/test/java/org/apache/servicecomb/deployment/TestDeployment.java
new file mode 100644
index 000000000..497c50eba
--- /dev/null
+++ 
b/deployment/src/test/java/org/apache/servicecomb/deployment/TestDeployment.java
@@ -0,0 +1,75 @@
+/*
+ * 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.deployment;
+
+import org.apache.servicecomb.config.ConfigUtil;
+import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestDeployment {
+  @After
+  public void tearDown() {
+    ArchaiusUtils.resetConfig();
+  }
+
+  @Test
+  public void testConfiguration() {
+    DefaultDeploymentProvider.setConfiguration(ConfigUtil.createLocalConfig());
+    SystemBootstrapInfo info = 
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_SERVICE_CENTER);
+    Assert.assertEquals(info.getAccessURL().get(0), "https://127.0.0.1:30100";);
+    info = 
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER);
+    Assert.assertEquals(info.getAccessURL().get(0), "http://lcalhost/custom";);
+
+    Assert.assertNull(Deployment.getSystemBootStrapInfo("wrong"));
+  }
+
+  @Test
+  public void testConfigurationEnv() {
+    System.setProperty("servicecomb.service.registry.address", 
"https://localhost:9999";);
+    System.setProperty("servicecomb.config.client.serverUri", 
"https://localhost:9988";);
+    DefaultDeploymentProvider.setConfiguration(ConfigUtil.createLocalConfig());
+
+    SystemBootstrapInfo info = 
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_SERVICE_CENTER);
+    Assert.assertEquals(info.getAccessURL().get(0), "https://localhost:9999";);
+    info = 
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER);
+    Assert.assertEquals(info.getAccessURL().get(0), "http://lcalhost/custom";);
+
+    System.getProperties().remove("servicecomb.service.registry.address");
+    System.getProperties().remove("servicecomb.config.client.serverUri");
+  }
+
+  @Test
+  public void testConfigurationEnvTwo() {
+    System.setProperty("servicecomb.service.registry.address", 
"https://localhost:9999,https://localhost:9998";);
+    System.setProperty("servicecomb.config.client.serverUri", 
"https://localhost:9988,https://localhost:9987";);
+    DefaultDeploymentProvider.setConfiguration(ConfigUtil.createLocalConfig());
+
+    SystemBootstrapInfo info = 
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_SERVICE_CENTER);
+    Assert.assertEquals(info.getAccessURL().size(), 2);
+    Assert.assertEquals(info.getAccessURL().get(0), "https://localhost:9999";);
+    Assert.assertEquals(info.getAccessURL().get(1), "https://localhost:9998";);
+    info = 
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER);
+    Assert.assertEquals(info.getAccessURL().get(0), "http://lcalhost/custom";);
+    Assert.assertEquals(info.getAccessURL().size(), 1);
+
+    System.getProperties().remove("servicecomb.service.registry.address");
+    System.getProperties().remove("servicecomb.config.client.serverUri");
+  }
+}
diff --git 
a/deployment/src/test/resources/META-INF/services/org.apache.servicecomb.deployment.DeploymentProvider
 
b/deployment/src/test/resources/META-INF/services/org.apache.servicecomb.deployment.DeploymentProvider
new file mode 100644
index 000000000..d07cc1e76
--- /dev/null
+++ 
b/deployment/src/test/resources/META-INF/services/org.apache.servicecomb.deployment.DeploymentProvider
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.servicecomb.deployment.CustomDeploymentProvider
diff --git a/dynamic-config/config-cc/pom.xml b/dynamic-config/config-cc/pom.xml
index 16d211c30..8aa24a1bb 100644
--- a/dynamic-config/config-cc/pom.xml
+++ b/dynamic-config/config-cc/pom.xml
@@ -33,6 +33,10 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-config</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>deployment</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-ssl</artifactId>
diff --git 
a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
 
b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
index 8cf1a6599..7fd362d2e 100644
--- 
a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
+++ 
b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
@@ -24,6 +24,8 @@
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.servicecomb.deployment.Deployment;
+import org.apache.servicecomb.deployment.DeploymentProvider;
 import org.apache.servicecomb.config.ConfigMapping;
 import org.apache.servicecomb.config.client.ConfigCenterClient;
 import org.apache.servicecomb.config.client.ConfigCenterConfig;
@@ -51,15 +53,12 @@
 
   private ConfigCenterClient configCenterClient;
 
-  private static final String CONFIG_CENTER_URL_KEY = 
"servicecomb.config.client.serverUri";
-
   public ConfigCenterConfigurationSourceImpl() {
   }
 
   @Override
   public boolean isValidSource(Configuration localConfiguration) {
-    if (localConfiguration.getProperty(CONFIG_CENTER_URL_KEY) == null) {
-      LOGGER.warn("Config Center configuration source is not configured!");
+    if 
(Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER) 
== null) {
       return false;
     }
     return true;
diff --git 
a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterConfig.java
 
b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterConfig.java
index f78eee4a9..3f570ba80 100644
--- 
a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterConfig.java
+++ 
b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterConfig.java
@@ -23,6 +23,9 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.servicecomb.deployment.Deployment;
+import org.apache.servicecomb.deployment.DeploymentProvider;
+
 import com.google.common.base.Joiner;
 import com.netflix.config.ConcurrentCompositeConfiguration;
 
@@ -33,8 +36,6 @@
 
   private static final String AUTO_DISCOVERY_ENABLED = 
"servicecomb.service.registry.autodiscovery";
 
-  private static final String SERVER_URL_KEY = 
"servicecomb.config.client.serverUri";
-
   private static final String REFRESH_MODE = 
"servicecomb.config.client.refreshMode";
 
   private static final String REFRESH_PORT = 
"servicecomb.config.client.refreshPort";
@@ -172,12 +173,7 @@ public String getServiceName() {
   }
 
   public List<String> getServerUri() {
-    String[] result = finalConfig.getStringArray(SERVER_URL_KEY);
-    List<String> configCenterUris = new ArrayList<>(result.length);
-    for (int i = 0; i < result.length; i++) {
-      configCenterUris.add(result[i]);
-    }
-    return configCenterUris;
+    return 
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER).getAccessURL();
   }
 
   public boolean getAutoDiscoveryEnabled() {
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 fd549b505..4c1b65fd7 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
@@ -210,7 +210,7 @@ private static ConfigCenterConfigurationSource 
createConfigCenterConfigurationSo
     }
 
     if (!configCenterConfigurationSource.isValidSource(localConfiguration)) {
-      LOGGER.info("Config Source serverUri is not correctly configured.");
+      LOGGER.warn("Config Source serverUri is not correctly configured.");
       return null;
     }
     return configCenterConfigurationSource;
diff --git a/java-chassis-dependencies/pom.xml 
b/java-chassis-dependencies/pom.xml
index c09c5d02d..031a6db28 100644
--- a/java-chassis-dependencies/pom.xml
+++ b/java-chassis-dependencies/pom.xml
@@ -780,6 +780,11 @@
         <artifactId>foundation-config</artifactId>
         <version>1.1.0-SNAPSHOT</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>deployment</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.servicecomb</groupId>
         <artifactId>config-cc</artifactId>
diff --git a/java-chassis-distribution/pom.xml 
b/java-chassis-distribution/pom.xml
index 3b917f8b6..7b9b54d37 100644
--- a/java-chassis-distribution/pom.xml
+++ b/java-chassis-distribution/pom.xml
@@ -100,6 +100,10 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-config</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>deployment</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-metrics</artifactId>
diff --git a/pom.xml b/pom.xml
index 40e6ce09a..e65693a06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,7 @@
     <module>java-chassis-dependencies</module>
     <module>common</module>
     <module>foundations</module>
+    <module>deployment</module>
     <module>handlers</module>
     <module>providers</module>
     <module>transports</module>
diff --git a/service-registry/pom.xml b/service-registry/pom.xml
index 58635367e..f53e9ebd1 100644
--- a/service-registry/pom.xml
+++ b/service-registry/pom.xml
@@ -30,6 +30,10 @@
   <name>Java Chassis::Service Registry</name>
 
   <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>deployment</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-vertx</artifactId>
diff --git 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
index 9832735b9..6a7bc0022 100644
--- 
a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
+++ 
b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
@@ -22,6 +22,8 @@
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.servicecomb.deployment.Deployment;
+import org.apache.servicecomb.deployment.DeploymentProvider;
 import org.apache.servicecomb.foundation.common.net.IpPort;
 import org.apache.servicecomb.foundation.common.net.NetUtils;
 import org.slf4j.Logger;
@@ -130,10 +132,7 @@ public boolean isSsl() {
   }
 
   public ArrayList<IpPort> getIpPort() {
-    DynamicStringProperty property =
-        DynamicPropertyFactory.getInstance()
-            .getStringProperty("servicecomb.service.registry.address", 
"https://127.0.0.1:30100";);
-    List<String> uriList = Arrays.asList(property.get().split(","));
+    List<String> uriList = 
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_SERVICE_CENTER).getAccessURL();
     ArrayList<IpPort> ipPortList = new ArrayList<>();
     uriList.forEach(anUriList -> {
       try {
@@ -189,7 +188,8 @@ public int getRequestTimeout() {
   public int getHeartBeatRequestTimeout() {
     DynamicIntProperty property =
         DynamicPropertyFactory.getInstance()
-            
.getIntProperty("servicecomb.service.registry.client.timeout.heartbeat", 
DEFAULT_REQUEST_HEARTBEAT_TIMEOUT_IN_MS);
+            
.getIntProperty("servicecomb.service.registry.client.timeout.heartbeat",
+                DEFAULT_REQUEST_HEARTBEAT_TIMEOUT_IN_MS);
     int timeout = property.get();
     return timeout < 1 ? DEFAULT_REQUEST_HEARTBEAT_TIMEOUT_IN_MS : timeout;
   }
diff --git 
a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/config/TestServiceRegistryConfig.java
 
b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/config/TestServiceRegistryConfig.java
index a40015fa4..c6211636f 100644
--- 
a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/config/TestServiceRegistryConfig.java
+++ 
b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/config/TestServiceRegistryConfig.java
@@ -20,6 +20,8 @@
 import java.util.List;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.servicecomb.deployment.DefaultDeploymentProvider;
+import org.apache.servicecomb.config.ConfigUtil;
 import org.apache.servicecomb.foundation.common.net.IpPort;
 import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
 import org.junit.AfterClass;
@@ -33,7 +35,8 @@
   @BeforeClass
   public static void initClass() {
     ArchaiusUtils.resetConfig();
-    ArchaiusUtils.setProperty("servicecomb.service.registry.address", 
"http://127.0.0.1, https://127.0.0.1";);
+    System.setProperty("servicecomb.service.registry.address", 
"http://127.0.0.1, https://127.0.0.1";);
+    DefaultDeploymentProvider.setConfiguration(ConfigUtil.createLocalConfig());
   }
 
   @AfterClass


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Provide a way to configure bootstrap information in Cloud Native enviroment
> ---------------------------------------------------------------------------
>
>                 Key: SCB-1048
>                 URL: https://issues.apache.org/jira/browse/SCB-1048
>             Project: Apache ServiceComb
>          Issue Type: New Feature
>          Components: Java-Chassis
>            Reporter: liubao
>            Assignee: liubao
>            Priority: Major
>
> # About Bootstrap Module
> Bootstrap is a mechanism to manage how microservics interact with external 
> services. When running a microservic in a Cloud Native enviroment, it will 
> interact with many external services, like service center, config center, an 
> APM service to report tracing data, a dashboard service to report health 
> data, etc. Bootstrap manages the meta data of these services. Bootstrap 
> queries the addresses , the parameters, the authentication information of 
> these services and so on.
> Bootstrap is some kind of service like service center, they are differ from 
> two aspects:
> 1. All microservics will report their information to service center. But 
> Bootstrap acts as a management system and knows the meta information in 
> deploy time. 
> 2. Service center provide some other functions like instance management and 
> heartbeat, But Bootstrap only provide metadata query services and it is 
> simple.
> Bootstrap does not provide a management service, it providers the interface 
> to interacts with management service. Service Providers can implement the 
> interface.
> They are some design constraints need to be considered when implment 
> Bootstrap interface:
> 1. Bootstrap can only read configurations of environment, microservics.yaml. 
> It can not read dynamic configurations.
> 2. Bootstrap is initialized before bean initialization.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to