Update documentation around discovery first lookup (#1865)

* Added warning to documentation
This commit is contained in:
Ryan Baxter
2021-04-19 14:56:48 -04:00
committed by GitHub
parent cbc0bbcada
commit 9c695648be

View File

@@ -1512,14 +1512,14 @@ When a config client starts, it binds to the Config Server (through the `spring.
The net result of this behavior is that all client applications that want to consume the Config Server need a `bootstrap.yml` (or an environment variable) with the server address set in `spring.cloud.config.uri` (it defaults to "http://localhost:8888").
[[discovery-first-bootstrap]]
==== Discovery First Bootstrap
==== Discovery First Lookup
WARNING: Unless you are using <<config-first-bootstrap, config first bootstrap>>, you will need to have a `spring.config.import` property in your configuration properties.
For example, `spring.config.import=optional:configserver:`.
If you use a `DiscoveryClient` implementation, such as Spring Cloud Netflix and Eureka Service Discovery or Spring Cloud Consul, you can have the Config Server register with the Discovery Service.
Using the `DiscoveryClient` to locate the config server requires that the config client *must use* <<config-first-bootstrap,config first bootstrap>> and *cannot use* <<config-data-import,config data import>>.
If you prefer to use `DiscoveryClient` to locate the Config Server, you can do so by setting `spring.cloud.config.discovery.enabled=true` (the default is `false`).
The net result of doing so is that client applications all need a `bootstrap.yml` (or an environment variable) with the appropriate discovery configuration.
For example, with Spring Cloud Netflix, you need to define the Eureka server address (for example, in `eureka.client.serviceUrl.defaultZone`).
The price for using this option is an extra network round trip on startup, to locate the service registration.
The benefit is that, as long as the Discovery Service is a fixed point, the Config Server can change its coordinates.