From 070e0a8518fdea11dc508ee592d0843fa516b259 Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Tue, 4 Feb 2020 18:26:44 +0100 Subject: [PATCH] Add info on SimpleDiscoveryClient in the docs. Remove redundant param. (#684) * Add info on SimpleDiscoveryClient in the docs. Remove redundant parameter. * Remove warning after discussion. --- docs/src/main/asciidoc/spring-cloud-commons.adoc | 12 ++++++++++++ .../SimpleDiscoveryClientAutoConfiguration.java | 3 +-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-commons.adoc b/docs/src/main/asciidoc/spring-cloud-commons.adoc index b85851b9..f89a3a75 100644 --- a/docs/src/main/asciidoc/spring-cloud-commons.adoc +++ b/docs/src/main/asciidoc/spring-cloud-commons.adoc @@ -277,6 +277,18 @@ 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. + === 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 05ae528f..a513ddeb 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.cloud.commons.util.InetUtils; 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 class SimpleDiscoveryClientAutoConfiguration } @Bean - @Order(Ordered.LOWEST_PRECEDENCE) + @Order public DiscoveryClient simpleDiscoveryClient() { return new SimpleDiscoveryClient(simpleDiscoveryProperties()); }