Published in


Spring Cloud Config Server

Spring Cloud Config Server Development

Photo by sendi gibran on Unsplash

There are many sites and posts about the details of development with Spring Boot and Spring Cloud but this post will be just about implementation and some notes about what I did and why I did it that way.

Config Server Project

If you do not want to use git but a local path for properties file location, you should add “native” to your spring profiles in your config server project:,dev

So this is my final file for my config server project:


What makes a project a config “server” is this dependency:


Do not forget to add @EnableConfigServer annotation to your Application class:

public class ConfigServerApplication {

public static void main(String[] args) {, args);


Your Main Project:

In the earlier versions, you needed to create a separate properties file named “” and add the properties added below to this file. “” file is different from “” as it is loaded before main application context.

So go to your main project where you will be using these properties and add to your “” there.


You need to add “optional” in front of your config url in properties so that if even if there is a failure, your main application will still be up and running.

After that, in your main project, just add this dependency (since your main project is the config server’s client).


Your Main Project’s Application Properties In Config Server

In your config server project, add a file named “” in the same level as config server’s own file. Pay attention to how I gave the file name: my-batch-app-name + “-dev” + “.properties”. You can add a default “” and also for (environmental) profile names (like,, etc.).


You can see an example syntax of property keys here. “.” is used to group and “-” is equivalent to uppercase in Java class (“job-count” maps to “jobCount”).

Config Class

It would be better to have a separate config class for holding your properties (in your main project) rather than @Value(“${my.config.key}”) fashion in your classes.

This is a good practice for both separations of concerns and refresh policy. When you update your property value and do a refresh to apply (will mention refresh later), your classes, using these values, might be blocking each other during refresh.

However, a single config bean with @ConfigurationProperties annotation is much more an efficient way to refresh context faster.

You can read what goes on in the background here.

Get / Refresh Values

To refresh property values that your project uses after update in config server-side (manually, without Spring Cloud Config):

To GET your projects properties

curl -L -X GET ‘http://localhost:8888/senoritadev-batch-jobs/dev'

After you edit, use this cURL request to refresh at your project’s side (8081 is your main project’s server port). List of added/updated properties are sent as a response to this POST request.

curl -L -X POST ‘' \
-H ‘Content-Type: application/json’ \
— data-raw ‘’

Happy Coding!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nil Seri

I would love to change the world, but they won’t give me the source code | coding 👩🏼‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨