To be able to get their configurations from the config server, our microservices need to be updated. This can be done through the following steps:
- Add the spring-cloud-starter-config, and spring-retry dependencies to the Gradle build file, build.gradle.
- Move the configuration file, application.yml, to the config repository and rename it to the name of the client as specified by the property, spring.application.name.
- Add a file named bootstrap.yml to the src/main/resources folder. This file holds the configuration required to connect to the config server. Refer to the following for an explanation of its content.
- Add credentials for accessing the config server to the Docker Compose files, for example, the product service:
product:
environment:
- CONFIG_SERVER_USR=${CONFIG_SERVER_USR}
-...