Spring Cloud Tutorial

author-imageBy Amit K Swain, 10 March,2018   1K

The rise in popularity of cloud-based architectures and the shift to implementing applications as series of focused microservices developed around bounded contexts has led to the discovery and rediscovery of patterns and techniques useful in designing distributed systems.

Netflix, a pioneer in the microservices space, has built many such tools. Eureka is a service registry, which registers all of a microservice’s instances and supplies each microservice with instance information to use in discovering others. Hystrix, the Hystrix Dashboard, and Turbine provide fault tolerance using circuit breakers and enable monitoring of circuits across microservices and instances.

Spring Cloud builds on Spring Boot by providing a bunch of libraries that enhance the behaviour of an application when added to the classpath.You can take advantage of the basic default behaviour to get started really quickly, and then when you need to, you can configure or extend to create a custom solution. The family of projects provided by Spring cloud ease the development of microservices using annotations.

Following is the maven dependency required to get started wih spring cloud.


Note: We can use different community versions like Dalston and Camden instead of Finchley

Let's follow the articles below to explore more about the behaviour of Netflix stacks used by spring cloud.

Introduction to Microservices

MicroServices or Microservice Architecture is a distinct method of developing and designing software systems. The concept of a microservice originally crept into the software development community’s consciousness around 2014 and was a direct response to many of the challenges faced with old monlithic architecture.In this post we will focus on the crave of microservices.

Spring Cloud NetFlix Eureka

This tutorial is about spring cloud Netflix Eureka. we will be creating eureka discovery server and microservices that will itself register to the discovery server and the client that will use netflix client API to discover the service and consume the microservices exposed by the service with sample example.Hence, we will be developing 3 different spring boot application for each discovery server, service and client.Also, we wil take a look into default eureka dashboard and different useful information available in the dashboard.

Spring Netflix Zuul

In this tutorial, we will be discussing about how to route in cloud native apps to different services using spring netflix zuul proxy.We will have multiple micro services running and an API gateway that does intelligent routing through proxy based on the requested resource.We will be also discussing about setting up Zuul Filter to intercept all the request and perform some operations to all the requests that pass through the API gateway.

Spring Cloud Hystrix Example

In this tutorial, we will be discussing about creating self healing and fault tolerance services with circuit breaker pattern using Netflix Hystrix.We will be discussing about failures in a distributed system and how Netflix spring cloud Netflix hystrix helps to create such fault tolerance system using annotations such as @EnableCircuitBreaker, @HystrixCommand.At the end, we will enable hystrix dashboard within our example using @EnableHystrixDashboard.

Spring Cloud Configuration - Externalize Application Configuration

This tutorial is about spring cloud config.Here, we will take a look at how we can manage to serve and store distributed external configurations properties using spring cloud config across different applications for different environments such as dev, local, prod etc.First we will develop a simple cloud application to externalize application configurations properties using cloud config and then extend the same application to use discovery server to register the application, updating the configuration at runtime and encrypting and decrypting sensitive properties.

Refresh Property Config at Runtime in Spring Cloud Config

In this tutorial series of spring cloud config, we will be discussing about refreshing property configuration at run-time.We will be doing so using spring boot actuator /refresh endpoint.Also, we will take a look into refreshing @Value properties using @RefreshScope annotation.

Spring Cloud Netflix Feign

In this article we will discuss about the declarative HTTP client provided by Netflix i.e FeignIt has pluggable annotation support including Feign annotations and JAX-RS annotations provided by Spring cloud.Spring Cloud integrates Ribbon and Eureka to provide a load balanced HTTP client when using Feign.

Further Reading on Spring Cloud

1. Spring Netflix Zuul

2. Refresh Property Config Runtime

3. Spring Cloud Netflix Eureka

4. Introduction To Microservices

5. Encrypt Decrypt Cloud Config Properties

If You Appreciate What We Do Here On Devglan, You Should Consider: