[
https://issues.apache.org/jira/browse/SCB-521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16455809#comment-16455809
]
ASF GitHub Bot commented on SCB-521:
------------------------------------
liubao68 closed pull request #679: [SCB-521] Config of Spring Boot should takes
higher priority than microservice.yaml
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/679
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/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 a5ff2e61c..bb3b41322 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
@@ -130,17 +130,17 @@ public static ConcurrentCompositeConfiguration
createLocalConfig(List<ConfigMode
duplicateServiceCombConfigToCse(config,
convertEnvVariable(new ConcurrentMapConfiguration(new
EnvironmentConfiguration())),
"configFromEnvironment");
- duplicateServiceCombConfigToCse(config,
- new DynamicConfiguration(
- new MicroserviceConfigurationSource(configModelList), new
NeverStartPollingScheduler()),
- "configFromYamlFile");
- // If there is extra configurations, add it into config. Extra config has
lowest priority.
+ // If there is extra configurations, add it into config.
EXTRA_CONFIG_MAP.entrySet().stream()
.filter(mapEntry -> !mapEntry.getValue().isEmpty())
.forEachOrdered(configMapEntry ->
duplicateServiceCombConfigToCse(config,
new ConcurrentMapConfiguration(configMapEntry.getValue()),
configMapEntry.getKey()));
+ duplicateServiceCombConfigToCse(config,
+ new DynamicConfiguration(
+ new MicroserviceConfigurationSource(configModelList), new
NeverStartPollingScheduler()),
+ "configFromYamlFile");
return config;
}
diff --git
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
index b10142de7..cd04d4e70 100644
---
a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
+++
b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestConfigUtil.java
@@ -326,14 +326,15 @@ public void testCreateLocalConfigWithExtraConfig() {
String extraConfigValue = "value";
String overriddenConfigKey = "servicecomb.cse.servicecomb.file";
extraConfig.put(extraConfigKey, extraConfigValue);
- extraConfig.put(overriddenConfigKey, "should_be_overridden");
+ final String propertyHigherPriority = "higher_priority";
+ extraConfig.put(overriddenConfigKey, propertyHigherPriority);
ConfigUtil.addExtraConfig("testExtraConfig", extraConfig);
ConcurrentCompositeConfiguration localConfiguration =
ConfigUtil.createLocalConfig();
Assert.assertEquals(extraConfigValue,
localConfiguration.getProperty(extraConfigKey));
- Assert.assertEquals("value",
localConfiguration.getString(overriddenConfigKey));
+ Assert.assertEquals(propertyHigherPriority,
localConfiguration.getString(overriddenConfigKey));
}
@SuppressWarnings("unchecked")
diff --git a/foundations/foundation-config/src/test/resources/microservice.yaml
b/foundations/foundation-config/src/test/resources/microservice.yaml
index f43982923..a7b123716 100644
--- a/foundations/foundation-config/src/test/resources/microservice.yaml
+++ b/foundations/foundation-config/src/test/resources/microservice.yaml
@@ -64,4 +64,4 @@ service_description:
servicecomb:
cse:
servicecomb:
- file: value
+ file: value # this is a config for
TestConfigUtil.testCreateLocalConfigWithExtraConfig()
diff --git
a/integration-tests/spring-jaxrs-tests/src/test/resources/application.properties
b/integration-tests/spring-jaxrs-tests/src/test/resources/application.properties
index 39d02011b..79e10ad70 100644
---
a/integration-tests/spring-jaxrs-tests/src/test/resources/application.properties
+++
b/integration-tests/spring-jaxrs-tests/src/test/resources/application.properties
@@ -16,5 +16,4 @@
#
property.test0=from_properties
-property.test4=from_properties
property.test5=from_properties
diff --git
a/integration-tests/spring-jaxrs-tests/src/test/resources/microservice.yaml
b/integration-tests/spring-jaxrs-tests/src/test/resources/microservice.yaml
index 49937a23e..16660f63c 100644
--- a/integration-tests/spring-jaxrs-tests/src/test/resources/microservice.yaml
+++ b/integration-tests/spring-jaxrs-tests/src/test/resources/microservice.yaml
@@ -16,5 +16,6 @@
# ---------------------------------------------------------------------------
property:
+ test2: from_microservice_yaml
test4: from_microservice_yaml
test5: from_microservice_yaml
diff --git
a/integration-tests/spring-zuul-tracing-tests/src/test/resources/application.properties
b/integration-tests/spring-zuul-tracing-tests/src/test/resources/application.properties
index 9c2440b2e..171496548 100644
---
a/integration-tests/spring-zuul-tracing-tests/src/test/resources/application.properties
+++
b/integration-tests/spring-zuul-tracing-tests/src/test/resources/application.properties
@@ -18,5 +18,4 @@
spring.main.web-environment=true
property.test0=from_properties
-property.test4=from_properties
-property.test5=from_properties
\ No newline at end of file
+property.test5=from_properties
diff --git
a/integration-tests/spring-zuul-tracing-tests/src/test/resources/microservice.yaml
b/integration-tests/spring-zuul-tracing-tests/src/test/resources/microservice.yaml
index ca417ce7b..0859d00ff 100644
---
a/integration-tests/spring-zuul-tracing-tests/src/test/resources/microservice.yaml
+++
b/integration-tests/spring-zuul-tracing-tests/src/test/resources/microservice.yaml
@@ -38,5 +38,6 @@ servicecomb:
address: http://localhost:9411/
property:
+ test2: from_microservice_yaml
test4: from_microservice_yaml
test5: from_microservice_yaml
----------------------------------------------------------------
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]
> change the priority of ServiceComb config and SpringBoot config
> ---------------------------------------------------------------
>
> Key: SCB-521
> URL: https://issues.apache.org/jira/browse/SCB-521
> Project: Apache ServiceComb
> Issue Type: Bug
> Reporter: YaoHaishi
> Assignee: YaoHaishi
> Priority: Major
> Attachments: ComplieWarning.PNG
>
>
> The configurations of SpringBoot should take higher priority than ServiceComb
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)