You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/06/20 01:02:50 UTC
[servicecomb-docs] branch master updated:
[SCB-1986]ServiceRegistryConfig is a bit complicated, make it easier
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-docs.git
The following commit(s) were added to refs/heads/master by this push:
new 0f39950 [SCB-1986]ServiceRegistryConfig is a bit complicated, make it easier
0f39950 is described below
commit 0f399506778bc836c63ac0e95a69141c66e55d16
Author: liubao <bi...@qq.com>
AuthorDate: Fri Jun 19 16:21:15 2020 +0800
[SCB-1986]ServiceRegistryConfig is a bit complicated, make it easier
---
.../zh_CN/docs/registry/multi-registries.md | 24 ++--------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/java-chassis-reference/zh_CN/docs/registry/multi-registries.md b/java-chassis-reference/zh_CN/docs/registry/multi-registries.md
index 1dcc9d8..1796994 100644
--- a/java-chassis-reference/zh_CN/docs/registry/multi-registries.md
+++ b/java-chassis-reference/zh_CN/docs/registry/multi-registries.md
@@ -13,28 +13,8 @@ public class ServerBServiceCenterConfiguration {
@Bean("serverBServiceCenterConfig")
public ServiceRegistryConfig serverBServiceCenterConfig() {
ServiceRegistryConfig config = ServiceRegistryConfig.buildFromConfiguration();
- String address = DynamicPropertyFactory.getInstance()
- .getStringProperty("servicecomb.service.registry-serverB.address", null)
- .get();
- if (address == null) {
- throw new IllegalStateException("service center address is required.");
- }
- String[] urls = address.split(",");
- List<String> uriList = Arrays.asList(urls);
- ArrayList<IpPort> ipPortList = new ArrayList<>();
- uriList.forEach(anUriList -> {
- try {
- URI uri = new URI(anUriList.trim());
- if ("https".equals(uri.getScheme())) {
- config.setSsl(true);
- }
- ipPortList.add(NetUtils.parseIpPort(uri));
- } catch (Exception e) {
- throw new IllegalStateException("service center address is required.", e);
- }
- });
- config.setIpPort(ipPortList);
- return config;
+ return ServiceRegistryConfigCustomizer.from(config)
+ .addressListFromConfiguration("servicecomb.service.registry-serverB.address").get();
}
}
```