Implementing a configuration server

A Spring Cloud configuration server is built on the top of a regular Spring Boot application. All you need to do is add the following additional dependency:

compile('org.springframework.cloud:spring-cloud-config-server')

Once the dependency has been added, you need to activate the configuration server using an additional annotation in the application, as shown in the following code:

@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication
{
public static void main(String[] args)
{
SpringApplication.run(ConfigServerApplication.class, args);
}
}

Finally, you need to provide the Git repository URL, which stores the configuration for your microservices in the application.yaml file, as follows:

spring:
cloud:
config:
server:
git:
uri: https://github.com/enriquezrene/spring-architectures-config-server.git

The preceding Git repository has separate configuration files to manage the configuration for each microservice. For example, the configuration-demo.properties file is used to manage the configuration for the configuration demo microservice.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.87.161