Unlike a traditional monolithic application in which everything runs within a single instance, a microservice-based application consists of multiple instances of services running across multiple servers. Managing configuration settings for each of these service instances can be challenging as maintaining multiple copies of configuration settings across different servers, locations, and environments is error-prone and difficult to manage. This is especially true for the increasing number of services in microservices architecture and services deployed in the cloud with an auto-scaling feature where servers come and go in the cloud. As a result, need has grown for a better mechanism to manage configuration settings in microservice-based applications. This is where a centralized configuration server steps in to take these configuration settings into a centralized location that is externalized from the distributed services.

In this article, we will learn how to build a centralized configuration server using a Spring Cloud config server that uses Git repository as configuration storage. Will we also look at how to consume the remote configuration settings from a service build using Spring Boot.

Spring Cloud Config Server

A Spring Cloud config server is one of the more popular centralized configuration servers used in a microservice-based application. This is especially true with the increasing trend of Java developers building their application using Spring Boot; providing little to no effort of work to integrate their application to Spring Cloud config server. It uses a typical client and server approach for storing and serving configuration settings across these distributed services.


Prerequisites

Before getting ready to write some code, we need to create two Spring Boot projects: the server and the client project. We will be using Apache Maven in this article. You can use the Spring Initializr website to generate these projects with Spring Boot 2.x dependency. Alternatively you can download the sample server and client project from GitHub.

#spring-boot #centralized-configuration #programming #microservices #spring-cloud-config

Spring Cloud Config — Centralized Configuration in Microservices
1.15 GEEK