by BehindJava

How to name property files served by config server

Home » microservices » How to name property files served by config server

In this tutorial we are going to learn about naming property files in the Spring Cloud Config server.

Now we are going to create a new property file and add that property file to a repository this property file will be read by spring cloud config server and will make the values from this property file available to our microservices and to do this we need to register our micro services as clients.

When we start our micro services, which are not yet configured to use Spring cloud config server then each of our micro services reads each configuration properties form local application properties file which is a part of its project.


On the above image you can see three micro services i.e., micro service A,B,C where each of these microservices have their own local application properties file form which it reads configuration details.

when we configure our micro services to read application properties from a centralized Spring Cloud Config Server then each of these three micro services will be reading properties from two files where one is the application.propeties file which is being served by a config server and the other is a file present in the local project.

And if both of these property files have a property with the same name then a property which is being served by a config server has a higher priority and will be used instead of a local property and we can have even more specific property configuration for a specific micro service.

For example, if we want to specify even more specific configuration for a micro service A then we can add one more property file which has a name that matches the name of your micro service A and similarly we can also use profile names.