Spring Cloud Features and Components

Spring Cloud is a suite of modules/components for building modern Software as a Service (SaaS) applications, which must be scalable, easily deployable on cloud platforms, and delivered in the continuous deployment process. These modules help make an application/microservice compliant with Twelve-Factor rules.

1. Spring Cloud Features

Similar to every other opinionated framework for making cloud-ready applications, Spring cloud provides the following features:

  • Distributed/versioned configuration: refers to an externalized configuration in a distributed system. With the distributed configurations, we have an external central place to manage properties for applications across all environments.
  • Service registration and discovery: refers to the process where all microservices in a distributed environment register themselves with the common registry. A service registry enables client-side load-balancing and decouples service providers from consumers without the need for DNS.
  • Routing: helps to route or forward incoming requests to appropriate downstream services.
  • Service-to-service calls: refers to the process where a microservice communicates with other dependent microservices using a central configuration service and service registry.
  • Load balancing: helps in efficiently distributing the incoming requests to multiple backend servers or service instances to avoid overloading any single resource in the cluster.
  • Circuit breakers: prevent calls to microservice when it knows that the request may fail or time out. This is done so that clients don’t waste their valuable resources handling requests that are likely to fail.
  • Global locks: ensure that no two threads simultaneously access the same resource at the same time. These are pretty useful in certain situations.
  • Leadership election and cluster state: allows an application to work together with other applications to coordinate a cluster leadership via a third-party system such as Kubernetes.
  • Distributed messaging: allows reliable message queuing and delivery to the subscribers. There are quite a few popular libraries for implementing distributed messaging such as apache Kafka and RabbitMQ.

2. Spring Cloud Components

Let us map the design patterns, discussed above, to the software components that can be used to implement them.

  • Distributed/versioned configuration: can be implemented using Spring Cloud Configuration Server and Spring Cloud Zookeeper.
  • Service registration and discovery: can be implemented using Netflix Eureka, Spring Cloud LoadBalancer, Spring Cloud Zookeeper and HashiCorp Consul.
  • Circuit breaker: can be implemented using Resilience4j and Spring Retry modules.
  • Distributed tracing: can be implemented using Spring Cloud Sleuth and Zipkin.
  • Load balancer: can be implemented using Spring Cloud Gateway and Spring Security OAuth.
  • Continuous Integration: can be implemented using Spring Cloud Pipelines. Internally it supports Concourse and Jenkins.
  • API virtualization: can be added using Hoverfly.
  • Consumer Driven Contracts: can be implemented using Spring Cloud Contract.
  • Service Broker: can be implemented using Spring Cloud Open Service Broker.
  • Lifecycle management: can be implemented using Spring Cloud Skipper in multiple Cloud Platforms.

3. Legacy Components

Since the release of Spring Cloud Greenwich (v2.1), some of the Netflix tools have been placed in maintenance mode in Spring Cloud. The reasons are that Netflix is not adding new features to these components and there are better alternatives available.

  • Netflix Hystrix: replaced by Resilience4j.
  • Netflix Hystrix Dashboard/Netflix Turbine: replaced by Micrometer and monitoring system.
  • Netflix Ribbon: replaced by Spring Cloud LoadBalancer.
  • Netflix Zuul: replaced by Spring Cloud Gateway.
  • Archaius: replaced by Spring Cloud Config.

Later with the release of Spring Cloud Ilford (v2020.0.0), the only remaining Netflix component in Spring Cloud is Netflix Eureka.

4. Conclusion

In this short Spring cloud tutorial, we listed out the design patterns for building microservices in a distributed environment. we also looked upon the Spring cloud modules that help in implementing those design patterns in Spring cloud-based microservices development.

Happy Learning !!


Notify of
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.