Accessing the Config Server from clients

In the previous section, a Config Server is set up and accessed using a web browser. In this section, the Search microservice will be modified to use the Config Server. The Search microservice will act as a Config Client.

Follow the steps listed next to use the Config Server instead of reading properties from the application.properties file:

  1. Add the Spring Cloud Config dependency and the Actuator (if Actuator is not already in place) to pom.xml. The Actuator is mandatory for refreshing the configuration properties:
        <dependency>          <groupId>org.springframework.cloud</groupId>          <artifactId>spring-cloud-starter-config</artifactId>        </dependency>
  1. Add the following to include the Spring Cloud dependencies. ...

Get Building Microservices with Spring now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.