Spring Boot Configuration Server
1 min read

Spring Boot Configuration Server

About Spring Boot Configuration Server.
Spring Boot Configuration Server
Spring Cloud and Configuration Server

The Spring Boot configuration server is a single point of entry for Spring Boot application configurations. This makes your life easier if you deal with multiple spring boot applications and you need to manage their configurations, in the sense that you don't have to rebuild said applications to include updated configurations but instead you update the configurations outside.

How to create one

It's easy to create a configuration server: just go to the spring initializer and add the "Config Server" component to your application.

You can generate the project and load it in your favourite IDE to tweak it according to your needs (e.g., provide liveness/readiness endpoints)

Features

The configuration server provides dynamic reloading of properties, i.e., you can update properties (e.g. in git) and a new instance of the application will pick them up automatically.

The main feature from my point of view is the ability to provide configuration information to applications coming from different sources, like:

  • native - properties files stored in the application itself
  • git - properties siles retrieved from Git
  • Hashicorp vault - properties stored in the vault, which is the de facto standard for providing secrets to an application

You can enable these sources via profiles:

spring:
  profiles:
    active: vault, native

You can also write your own source!

If you have multiple sources, you can prioritise them. In other words, if you have the same property declared in e.g. git and vault, you can configure which of these instances should be preserved as the final value used by the application.

Note: I would not recommend using native mode for proper projects because it implies rebuilding the server application each time you make a change. However, access constraints may prevent you from git or vault access...

Credits