How to add Spring Cloud Config Server and load the configs from database

with 1 Comment

For our project basen on microservices architecture was select Spring Coud Config Server to externalize the applications properties.

First it should be defined server for it:

Add dependencies to build.gradle

The server is defined easily by @EnableConfigServer annotation

Create bootstrap.yml config file (Our application which we use for spring config server also used as eureka server and in this case should be defined bootstrap.yml with following properties)

So our server is done to work.

Next step is to configurate our server config not with properties files but with database where will be stored our microcervices properties.

Configurations domains:

Server is ready to return up to date configurations from db. Config now will be loaded from centralized place on every client service startup and once config is updated need to restart client service.

Time to configure the app (Spring Cloud Config Client) to work with the server.

Define dependencies

Create bootstrap.yml for the app where contains url on server and service name to take the configs

After writing authorization token on client side now we should improve our server side on security.

Add custom Config filter to the server:

Register our filter in server resources

Updating application server properties

One Response

  1. Rajesh
    | Reply

    Hi Can you tell me what kind of configuration we need to do in order for us to get properties from DataBase for Config server

Leave a Reply