Complete microservices architecture with real examples — Step 6 — Config server

Hey buddy! Do you have an idea about maintaining properties and configuration easily by spending the least amount of time? Then, definitely, you have to set up a Config Server which is another microservice with a version control system. Let’s quickly dive into the implementation of it.

Config server

Step 6 — Config Server

Let’s take a look at the project initialization with

Spring Initialzr — Config Server
  • Project build tool: Maven
  • Language: Java
  • Spring boot: 2.4.6
  • Project Metadata

Group: com.agnasarp

Artifact: agnasarp-config-server

Name: agnasarp-config-server

Description: Agnasarp Config Server

Package name: com.agnasarp.configserver

Packaging: Jar

Java version: 8

  • Dependencies:

Eureka Discovery Client: A REST based service for locating services for the purpose of load balancing and failover of middle-tier servers.

Config Server: Central management for configuration via Git, SVN, or HashiCorp Vault.

Project structure of config server in IntelliJ Idea


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
<relativePath/> <!-- lookup parent from repository -->
<description>Agnasarp Config Server</description>





port: 8580

clone-on-start: true
active: native

package com.agnasarp.configserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class AgnasarpConfigServerApplication {

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


Now we can create a repository in a version controlling system to manage configurations that may be used in all microservices we have created.

Remote repository for configurations

In that application.yml file, we can place the configurations that we use to connect Eureka Server as below. These can be removed from all other microservices because now we have the configuration centrally.

register-with-eureka: true
fetch-registry: true
defaultZone: http://localhost:8761/eureka/
hostname: localhost

Now we have to set up one configuration in each microservice to call Service Registry. We create bootstrap.yml and paste the below lines of code. This is going to be used to call Config Server just we set up

enabled: true
uri: http://localhost:8580

Suppose there is a configuration change so we can update it in the GitHub repository and call the refresh method in relevant microservices as below.

curl — location — request POST ‘http://localhost:8280/actuator/refresh'

Download source from github:

Download config-server

Download hystrix-dashboard

Download api-gateway

Download service-registry

Download department-service

Download user-service

Go to Step 1 — Department Microservice

Go to Step 2 — User Microservice

Go to Step 3 — Service Registry

Go to Step 4 — API Gateway

Go to Step 5— Circuit Breaker

Originally published at on May 25, 2021.



Agnasarp is a technology-focused blog that has enough information about cutting-edge technologies that you can use for your problems. Stay with us!

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

Agnasarp is a technology-focused blog that has enough information about cutting-edge technologies that you can use for your problems. Stay with us!