What is Spring Cloud Config server and Why is it required in Microservices
In this tutorial you will learn about creating your own Spring cloud config server and configuring your micro services to have a centralized configuration.
Until now, we kept all the application configuration details like port number, database connections and URLS to other microservices in a file called application.properties.
For example, in the diagram which you see below have an illustration of different micro services and each of them has an application configuration properties file.
The Charge for this application properties file begins when you have many micro services containing same configuration details and let’s say we have 30 or 60 microservices running and you need to make a change in the application configuration like there is a change database Ip address and to do this you need to make changes in all the applications and rebuild, re deploy and restart the micro services again.
This practice is fine when we have a monolithic application but not with the microservices and to over come this we have Spring Cloud config server which provides a server side and client side support for externalized configuration in a distributed format with Spring cloud config server where we have a centralization with a secure storage like secure file system backend or a secure vault backend or a private git repository to manage external properties for applications across all the environments.
Once these configurations are created. Is available to every spring boot application through environment object by auto wiring it as shown in our previous tutorials.
Spring cloud config server is also another spring boot application where other microservices connect to it through HTTP and retrieve their configuration details when your microservices startup.
You can still have properties in the individual application.properties of a spring boot application but properties auto wired form Spring cloud config servers are given with high priority since we are fetching them at runtime.