Spring Cloud

Table of contents
  1. Introducing Spring Cloud
  2. Spring Cloud
  3. Reference Links

Introducing Spring Cloud

Spring Cloud

Spring team has integrated number of battle-tested open source projects from companies like Pivotal, Netflix into a Spring project known as Spring Cloud. Spring Cloud provides libraries & tools to quickly build some of the common design patterns of distributed system, including the following:

Spring Cloud Patterns and Libraries

Category Pattern Name Spring Cloud Library
Development Patterns Distributed/versioned configuration management Spring Cloud Config Server
  Core Microservices Patterns Spring Boot
  Asynchronous/Distributed Messaging Spring Cloud Stream (AMQP and Kafka)
  Inter-Service Communication RestTemplate and Spring Cloud Feign
Routing Patterns Service Registration & Discovery Spring Cloud Netflix Eureka & Consul
  Service Routing/ API Gateway Pattern Spring Cloud Netflix Zuul
Resiliency Patterns Client side load balancing Spring Cloud Netflix Ribbon
  Circuit Breaker & Fallback Pattern Spring Cloud Netflix Hystrix
  Bulkhead pattern Spring Cloud / Spring Cloud Netflix Hystrix
Logging Patterns Log Correlation Spring Cloud Sleuth
  Microservice Tracing Spring Cloud Sleuth/Zipkin
Security Patterns Authorization and Authentication Spring Cloud Security OAuth2
  Credentials Management Spring Cloud Security OAuth2/ JWT
  Distributed Sessions Spring Cloud OAuth2 and Redis

Spring Cloud makes it really easy to develop, deploy and operate JVM applications for the Cloud.

Different release trains in Spring Cloud at the time of writing this handbook are (newest to oldest) - Finchley, Edgware, Dalston and Camden. Spring Cloud is always used in conjunction with Spring Boot.

A bare minimum build.gradle for any Spring Cloud project will look like:

build.gradle

buildscript {
    ext {
        springBootVersion = '1.5.12.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}
apply plugin: 'java'
apply plugin: 'spring-boot'
dependencyManagement {
    imports {
        mavenBom ':spring-cloud-dependencies:Edgware.SR3'
    }
}
dependencies {
    compile ':spring-cloud-starter-config'
    compile ':spring-cloud-starter-eureka'
}

  • Edgware.SR3 is the spring-cloud train version.
  • Spring cloud dependencies (eureka client and config client)

And a minimal version of spring-cloud Application:

@SpringBootApplication
@EnableDiscoveryClient
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

  • Enables spring-boot in your application.
  • Enables discovery-client: a spring-cloud feature in your microservice that helps you discover other services in a given environment.


Back to top

Copyright © 2022-2023 Interview Docs Email: docs.interview@gmail.com