/ Spring Cloud  

Spring Cloud 1: What is Spring Cloud

I have been learning Spring Cloud recently, and found it quite interesting. So I would write a series of blogs to introduce different components of Spring Cloud. Let’s begin with a brief introduction of Spring Cloud.

So what is Spring Cloud? In short, Spring Cloud is a collection of a series of frameworks. It is based on Spring Boot and make use of it to simplify the development of distributed system infrastructure. Spring Cloud consists of several useful functionalities such as service discovery, configuration center, message bus, load balance, and monitoring. It provides a complete set of solution to build an enterprise level cloud application.

Spring Cloud includes several sub-projects, such as Spring Cloud Config, Spring Cloud Netflix, Spring Cloud Security, etc. Spring collects those mature frameworks from different companies, uses Spring Boot style to re-encapsulate them and removes complicated configuration, and gives developers an easy-to-use, easy-to-deploy and easy-to-maintain distributed system development toolkit.

With Spring Cloud, every individual service could be a separated application. It can be deployed individually, scale horitontallly and accessed individually. Those services are service unit, which is always called microservice (because they are usually very ‘small’ service that provides a certain type of service). Spring Cloud is the manager of all those microservices. Using microservice architecture, the number of projects (modules) would be huge, but Spring Cloud facilitate the management of all that.

Now let’s look at some most important components of Spring Cloud. It is a brief introduction, I will discuss more details in the following blogs.

Key Components

Netflix Eureka

Service center. CLoud side service discovery. It’s the basic of Spring Cloud. All service register themselves at the service center. If one service need to invoke another service, it can find it in the service center as well.

Netflix Hystrix

Circuit breaker. Provides a powerful fault tolerant capability. For example, if a service is not responding, but other services are not aware of that, that failing service will affect the system performance. With Hystrix, it would notify other services that the failing service can’t be used.

Ribbon

Load balancer.

Netflix Zuul

Dynamic routing. Zuul is the front door of all front end applications and the back end services. When users invoke services, it must go through Zuul, see if the request is valid.

Spring Cloud Config

Configuration center. Developer can put all configurations to a remote server and manages those together rather than manage for each individual service.

Spring Cloud Bus

Event and message bus.

Spring Cloud Security

Security toolkit basic on Spring Security. Add security control to the cloud application.

Spring Cloud Sleuth

Logging toolkits. Provide solution of distributed routing tracking.

The relationship between all those components:



  • All request go through API gateway Zuul to get access to services.
  • API gateway obtain available service from service registry Eureka.
  • Ribbon complete load balancing and dispath request to back end service instancve.
  • All microserve use Feign to communicate.
  • Hystrix handles circuit breaker if services are unavailable.

These are the main components, but there a lot more other sercices that are provided by Spring Cloud.

Relationship with Spring Boot

Spring Boot can be used to develop individual microservice, while Spring Cloud is based on Spring Boot to facilitate cloud application development. One can use only Spring Boot to develop application without Spring Cloud, but to develop Spring Cloud, Spring Boot must be used. There is a dependency relationship.

Please note that there is a strict relationship with the version of Spring Cloud and Spring Boot. If the versions don’t match, the system won’t work. Below is the table shows the relationship.

Spring Cloud Spring Boot
Angel Spring Boot 1.2.x
Brixton Spring Boot 1.3.x, and Spring Boot 1.4.x
Camden Spring Boot 1.4.x, and Spring Boot 1.5.x
Dalston, Edgware Spring Boot 1.5.x, not compatiable with Spring Boot 2.0.x
Finchley Spring Boot 2.0.x, not compatiable with Spring Boot 1.5.x
Greenwich Spring Boot 2.1.x
Hoxton Spring Boot 2.2.x

In the following blogs, I will using Spring Cloud Greenwich version.

Advantage of Spring Cloud

There are other microservice frameworks, such as Dubbo, Kubernetes. What are Spring Cloud‘s advantages compared with those?

  • It is from Spring family. Make use of Spring Boot makes developing individual service a lot easier.
  • The community is very active. Lots of tutorials out there, and easy to find solutions.
  • Get circuit breaker, load balance, service discovery with only a few lines of code.