Reputation: 539
Reading this documentation: https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_client.html
I can see how to configure Spring-Cloud-Config server to register with Eureka. What I don't see is how to configure the Spring-Cloud-Config client application to discover the Spring-Cloud-Config server via Eureka.
Is it safe to assume if I have a Spring-Boot app that needs to contact Spring-Cloud-Config server to retrieve properties, that just annotating the app with @DiscoveryClient will be enough to automatically locate the Eureka server, discover the location of Spring-Cloud-Config and retrieve properties? It seems like I would at least need to configure the client with the Spring-Cloud-Config server's service ID. But I don't see anywhere how to do that.
Upvotes: 5
Views: 6458
Reputation: 1622
You need to provide serviceId and enable config service discovery in your Spring Cloud Config Client bootstrap.properties
.
# Flag to indicate that config server discovery is enabled (config server URL will be looked up via discovery).
spring.cloud.config.discovery.enabled=true
# Service id to locate config server.
spring.cloud.config.discovery.serviceId=yourConfigServiceId
See more in Discovery First Bootstrap documentation.
Upvotes: 6