Setting up a config server
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
andspring-boot-starter-security
, to the Gradle build file,build.gradle
. - Add the
@EnableConfigServer
annotation 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.endpoints.web.exposure.include: "*" logging: level: root: info ...