Create a microservices application architecture with Spring Boot and Spring Cloud - Part 2 - Config server


The config server will be a centralized location for holding configuration settings for the various services.  The configuration files in this case will be YAML files that the other services will look at for specific properties that they will need.


For the config server in this project, we are going to be using Spring Cloud Config ( because it’s easy to setup and use for what we need it for.

The above diagram explains the communication flow between the services and the config server.  Each service is going to have properties that are stored on the config server so that when that service boots up, it will contact the config server and grab it’s externalized config properties from there.

The advantages to this is to allow multiple instances of the same service to grab properties that need to be the same for all instances of that service.  If we didn’t have a config server, we would need to individually set properties per service instance which takes up time and effort.


1.)  Create a new Spring Boot app called, config_server, with a package of com.bryanlor.  Ensure that Gradle is used, which should be selected by default anyways.


2.)  Open up the build.gradle file.

3.)  Remove the content that’s currently in the build.gradle file and then add the following to the file instead: 

buildscript {
	ext {
		springBootVersion = '2.1.4.RELEASE'
	repositories {
	dependencies {

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.bryanlor'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
	maven { url "" }

ext['springCloudVersion'] = 'Greenwich.RC2'

dependencies {
	testImplementation 'org.springframework.boot:spring-boot-starter-test'

dependencyManagement {
	imports {
		mavenBom "${springCloudVersion}"

4.)  Save the file.

5.)  Right click on the project and go to Gradle → Refresh Gradle Project.  You can also use the gradle commands in the command-line to build the project so that it pulls in the dependencies needed. 


6.)  Open up

7.)  Add the following package import:


8.)  Then below the annotation, @SpringBootApplication, place the following annotation to enable the application as a config server: @EnableConfigServer.


9.)  Create an file in /src/main/resources/ if it doesn’t exist yet.


10.)  Open and make sure it has the following property:

11.)  Create a bootstrap.yml file in /src/main/resources/ if it doesn’t exist yet.

12.)  Open bootstrap.yml file and make sure it has the following properties:

  port: 8088

13.)  Start up the config server.

Code Repository

Grab the code at

Next tutorial part...

Create a microservices application architecture with Spring Boot and Spring Cloud - Part 3 - Discovery service