From ad98828430e0ca07904de3798783e99f9f4feec5 Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Tue, 4 Feb 2020 16:59:21 +0100 Subject: [PATCH 1/2] Add info on SimpleDiscoveryClient in the docs. Remove redundant parameter. --- docs/src/main/asciidoc/spring-cloud-commons.adoc | 16 ++++++++++++++++ .../SimpleDiscoveryClientAutoConfiguration.java | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-commons.adoc b/docs/src/main/asciidoc/spring-cloud-commons.adoc index b85851b9b..bfc4c3fb5 100644 --- a/docs/src/main/asciidoc/spring-cloud-commons.adoc +++ b/docs/src/main/asciidoc/spring-cloud-commons.adoc @@ -277,6 +277,22 @@ implementations provided by Spring Cloud, among others `ConsulDiscoveryClient`, `ZookeeperDiscoveryClient`. In order to do it, you just need to set the `spring.cloud.{clientIdentifier}.discovery.order` (or `eureka.client.order` for Eureka) property to the desired value. +==== SimpleDiscoveryClient + +If there is no Service-Registry-backed `DiscoveryClient` in the classpath, `SimpleDiscoveryClient` +instance, that uses properties to get information on service and instances, will be used. + +The information about the available instances should be passed to via properties in the following format: +`spring.cloud.discovery.client.simple.instances.service1[0].uri=http://s11:8080`, where +`spring.cloud.discovery.client.simple.instances` is the common prefix, then `service1` stands +for the ID of the service in question, while `[0]` indicates the index number of the instance +(as visible in the example, indexes start with `0`), and then the value of `uri` is +the actual URI under which the instance is available. + +WARN:: `SimpleDiscoveryClient` has been added for testing and demo purposes. We do not recommend +using it in production. + + === ServiceRegistry Commons now provides a `ServiceRegistry` interface that provides methods such as `register(Registration)` and `deregister(Registration)`, which let you provide custom registered services. diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientAutoConfiguration.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientAutoConfiguration.java index 05ae528f3..a513ddeb1 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientAutoConfiguration.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientAutoConfiguration.java @@ -30,7 +30,6 @@ import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; /** @@ -68,7 +67,7 @@ public SimpleDiscoveryProperties simpleDiscoveryProperties() { } @Bean - @Order(Ordered.LOWEST_PRECEDENCE) + @Order public DiscoveryClient simpleDiscoveryClient() { return new SimpleDiscoveryClient(simpleDiscoveryProperties()); } From a4764341008a12fc356e1c8edb2d5543bf923c99 Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Tue, 4 Feb 2020 17:51:32 +0100 Subject: [PATCH 2/2] Remove warning after discussion. --- docs/src/main/asciidoc/spring-cloud-commons.adoc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-commons.adoc b/docs/src/main/asciidoc/spring-cloud-commons.adoc index bfc4c3fb5..f89a3a755 100644 --- a/docs/src/main/asciidoc/spring-cloud-commons.adoc +++ b/docs/src/main/asciidoc/spring-cloud-commons.adoc @@ -289,10 +289,6 @@ for the ID of the service in question, while `[0]` indicates the index number of (as visible in the example, indexes start with `0`), and then the value of `uri` is the actual URI under which the instance is available. -WARN:: `SimpleDiscoveryClient` has been added for testing and demo purposes. We do not recommend -using it in production. - - === ServiceRegistry Commons now provides a `ServiceRegistry` interface that provides methods such as `register(Registration)` and `deregister(Registration)`, which let you provide custom registered services.