You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/spring-cloud-commons.adoc
+24
Original file line number
Diff line number
Diff line change
@@ -235,6 +235,30 @@ To disable it, set `spring.cloud.discovery.client.health-indicator.enabled=false
235
235
To disable the description field of the `DiscoveryClientHealthIndicator`, set `spring.cloud.discovery.client.health-indicator.include-description=false`.
236
236
Otherwise, it can bubble up as the `description` of the rolled up `HealthIndicator`.
237
237
238
+
==== Ordering `DiscoveryClient` instances
239
+
`DiscoveryClient` interface extends `Ordered` to let you define the order of the returned discovery clients, similar to
240
+
how you can order the beans loaded by a Spring application. By default, the order of any `DiscoveryClient` is set to
241
+
`Ordered.LOWEST_PRECEDENCE`, which equals `Integer.MAX_VALUE`. If you want to set a different order for your custom
242
+
`DiscoveryClient` implementations, you just need to override the `getOrder()` method so that it returns the value that
243
+
is suitable for your setup. Apart from this, you can use properties to set the order of the `DiscoveryClient`
244
+
implementations provided by Spring Cloud, among others `ConsulDiscoveryClient`, `EurekaDiscoveryClient` and
245
+
`ZookeeperDiscoveryClient`. In order to do it, you just need to set the
246
+
`spring.cloud.discovery.client.{clientIdentifier}.order` property to the desired value.
247
+
248
+
The following example shows how to set order value for Spring Cloud `DiscoveryClient` implementations:
249
+
250
+
[source,yaml,indent=0]
251
+
----
252
+
spring:
253
+
cloud:
254
+
discovery:
255
+
client:
256
+
eureka: 1
257
+
----
258
+
259
+
The following client identifiers are currently supported with this syntax: `eureka`, `consul`, `zookeeper`,
260
+
`cloudfoundry`, `simple`.
261
+
238
262
=== ServiceRegistry
239
263
240
264
Commons now provides a `ServiceRegistry` interface that provides methods such as `register(Registration)` and `deregister(Registration)`, which let you provide custom registered services.
0 commit comments