Setting up a config server on the basis of the decisions discussed is straightforward:
- Create a Spring Boot project using Spring Initializr as described in Chapter 3, Creating a Set of Cooperating Microservices. Refer to the Using Spring Initializr to generate skeleton code section.
- Add the dependencies, spring-cloud-config-server and spring-boot-starter-security, to the Gradle build file, build.gradle.
- Add the annotation, @EnableConfigServer, to the application class, ConfigServerApplication:
@EnableConfigServer
@SpringBootApplication
public class ConfigServerApplication {
- Add the configuration for the config server to the default property file, application.yml:
server.port: 8888
spring.cloud.config.server.native.searchLocations: file:${PWD}/config-repo
management.endpoint.health.show-details: "ALWAYS"
management...