Let's create a Spring Boot application that connects with the Spring Config Server to take advantage of reading external property sources from the central configuration server. So, for the client project, we have to add the following Maven configuration for the spring-cloud-starter-config
and spring-boot-starter-web
modules:
<dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
Next, let's create a client class that is a simple REST controller with one GET
method mapping:
package com.dineshonjava.cloudconfigclient; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.GetMapping...