I am following an blog :
https://github.com/jeroenbellen/blog-manage-and-reload-spring-properties
I am developing the services using spring boot and I want to change the config at run-time without application restart.
I have run the code mentioned in the above github repo. What I am not able to understand how does the example-service knows about config-service. There is nothing in code which link them together.
Also, there is just one example service but I have 10s of such example service, how do I use just one config service for all example services
First question
how does the example-service knows about config-service?
Short answer
Magic happen when you add spring-cloud-config-client
dependency
Long answer from spring cloud documentation
Client Side Usage
To use these features in an application, just build it as a Spring Boot application that depends on spring-cloud-config-client (e.g. see the test cases for the config-client, or the sample app). The most convenient way to add the dependency is via a Spring Boot starter org.springframework.cloud:spring-cloud-starter-config. There is also a parent pom and BOM (spring-cloud-starter-parent) for Maven users and a Spring IO version management properties file for Gradle and Spring CLI users.
Second question
Also, there is just one example service but I have 10s of such example service, how do I use just one config service for all example services
You just have to add spring-cloud-config-client
dependency to each service. All services will look for config-service on http://localhost:8888 8888 being the default port