Spring Cloud

Spring Cloud
Written by Sagar RabidasDecember 20, 2021
11 min read
Sagar Rabidas

Software Developer

In this blog, we will discuss Spring Cloud.

Introduction to Spring Cloud

Spring cloud is defined as an open-supply library that provides equipment for fast deploying the JVM based totally utility on the clouds, it presents an extensible mechanism and a better person revel in than its competition because of numerous features like dispensed configuration, circuit breakers, worldwide locks, service registrations, load balancing, cluster nation, routing, load balancing, and so on, it is also able to run with spring and exceptional applications in distinctive languages


Features of Spring Cloud

Spring Cloud provides a better experience and an extensible mechanism than others. Major features of Spring cloud are:

  • Distributed configuration
  • Distributed messaging
  • service-to-service calls
  • Circuit breakers
  • Global locks
  • Service registration
  • Service Discovery
  • Load balancing
  • Cluster state
  • Routing

Why we should require Spring Cloud?

We face the following issues during the development of distributed microservices using Spring Boot:

  • Performance issues: Different operational overheads affects performance badly.
  • Complexity in deployment: DevOps skills are required.
  • Redundancy: Distributed system often faces redundancy issues.
  • Load–balancing: Workload distribution across various computing resources is improved by Load Balancing.
  • Distributed system complexities: Complexities include bandwidth issues, network issues, security issues, latency issues, etc.
  • Service directory tools: These tools let the processes and services in the same cluster talk to each other.

How does it work?

Below is the explanation of how Spring Cloud works:

  • Spring Cloud config provides client-side and server support for various configurations in distributed systems.
  • It provides a centralized platform to manage various properties for all applications across different environments.
  • Both server and client concept maps to the Property Source abstractions and Spring applications identically.
  • They work properly with Spring applications and can be used with different applications in any language.
  • It lets you manage and configure all the environments when applications are moving through deployment pipelines from development to testing.
  • It also makes sure about all the necessities of an application when they migrate.
  • To add and plugin alternative implementations with Spring Cloud Config is easy.
  • The default value of
spring.cloud.config.URI i.e. http://localhost:8888/

is being contacted by Spring Boot applications until Spring Config Client and Spring Boot Actuator are on the classpath.

  • You may change the default
value spring.cloud.config.URI

can be set in

bootstrap.[yml | properties]

or in system properties.


public class DemoApplication {
String str = "Cloud";
public String new() {
return "Spring " + str;
public static void main(String[] args) {
SpringApplication.run(DemoApp.class, args);

  • Local configuration or remote Config server can provide the value for name.
  • You can try running your server using a spring-cloud-config-server.
  • To run the application on port 8888, you can set
spring. config.name=configserver

And the data then is served from sample repositories.

  • To locate the necessary configuration data, you may need

Set-Up Spring Cloud

Below are the steps to follow:

Step 1: Open the website https://start.spring.io/ and choose

Step 2: Select Spring Boot 1.4.X.

Step 3: Artifacts should be set to ‘config’.

Step 4: Add the config server’ module from the dependencies section.

Step 5: Click the Generate button to download a preconfigured project containing a zip file.

Step 6: You can also create a Spring Boot project by adding the dependencies to the POM file manually.

Step 7: These dependencies can be shared among all the projects.


<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-starter-parent </artifactId>
<version> 1.4.0.RELEASE </version>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-starter-test </artifactId>
<scope> test </scope>
<groupId> org.springframework.cloud </groupId>
<artifactId> spring-cloud-dependencies </artifactId>
<version> Brixton.SR5 </version>
<type> pom </type>
<scope> import </scope>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-maven-plugin </artifactId>

Step 8: Dependencies for the ‘config server’ is below:


<groupId> org.springframework.cloud </groupId>
<artifactId> spring-cloud-config-server </artifactId>

Step 9: The Application class should be added with the following to enable Config Server as mentioned in the previous example:


public class DemoApplication {

Step 10: The ‘application properties’ should be added to src/main/resources.


server.port = 8888
spring.application.name = config
spring.cloud.config.server.git.uri = file://${user.home}/application-config

Step 11: The Uri parameter is one of the most significant settings for the ‘config server’.

Step 12: On Windows, the Uri parameter is usually added to a relative path that resolves to

C:\users\<username>\. And on Linux, it is /users/<username>/.

Step 13: All the property files for various applications are stored in the above pointed Git repository.

Step 14: The folder ‘application-config’ should be then added to the folder cloud.config.server.git.URI.

Step 15: Navigate to that folder by using the ‘cd’ command and then type git init.

Step 16: A Git repository will be initiated now, that lets you store and track your files.

Step 17: Run the config server to check whether it’s working.

Step 18: Type mvn spring-boot: run command in the command line to start the server.

Step 19: The following output will be seen as an indication for a successful server start:

Tomcat started on port(s): 8888 (http)

Step 20: The config server manages the application properties in the servers.

Step 21: In the servers, each application’s properties should be configured in such a way that they should be able to talk back to the server.

Step 22: This process is a bootstrap process. Each of the applications should have a file called properties.

Step 23: It contains properties similar to application properties with few differences.

Step 24: The properties are initially loaded by a parent spring called Application Context.

Step 25: As it is critical, the config server will start the properties management of properties.

Step 26: The Application Context will also decrypt encrypted properties.

Step 27: These properties should be kept distinct.

Step 28: The properties initiate the config server and make it ready.

Step 29: The properties specify the properties for your application.

Step 30: Technically, the application properties can also be placed in properties.

Step 31: Though config servers are responsible for the management of application properties, we will still need the properties as they are available as default values and that are unavailable in config servers.


Various parts of Spring Cloud can be connected into a functional Microservice application. This is a base platform that lets you build various complex applications. Spring Cloud lets you build powerful cloud applications. All the problems faced by distributed environments are solved by using Spring Cloud.

Spring Boot
Sprin Cloud
Was this blog helpful?
You must be Logged in to comment
Code Block

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance