30
Spring Rebooted into the Cloud Dariusz Kaczyński

Spring Rebooted

  • Upload
    vonhan

  • View
    237

  • Download
    5

Embed Size (px)

Citation preview

Page 1: Spring Rebooted

Spring Rebootedinto the Cloud

Dariusz Kaczyński

Page 2: Spring Rebooted

Warsaw Spring Labs

founder & co-organizer

trainer

member

Java/Groovy Dev/Arch

@dkaczynski

[email protected]

co-organizerwww.devoxx4kids.pl

DariuszKaczyński

Page 3: Spring Rebooted

http://spring.io/platform

Page 4: Spring Rebooted

Source Code

Spring Boot

@dkaczynski#geecon

Page 5: Spring Rebooted

Spring Boot

● spring-boot-starter-parent

○ transient dependeincies versions

● spring-boot-maven-plugin

○ make JAR not WAR

● @SpringBootApplication

○ @Configuration & @EnableAutoConfiguration & @ComponentScan

● SpringApplication

○ application entry point

@dkaczynski#geecon

Page 6: Spring Rebooted

Spring Payback

Customer

Merchant

PaybackBuys

Reports

Receives

@dkaczynski#geecon

Page 7: Spring Rebooted

Source Code

Application Domain

@dkaczynski#geecon

Page 8: Spring Rebooted

Cloud Scale

Merchant

PaybackBuys

Reports

ReceivesCustomer

MerchantMerchant

CustomerCustomer

PaybackPayback

@dkaczynski#geecon

Page 9: Spring Rebooted

Cloud Simulator

docker-compose

lattice.cf

@dkaczynski#geecon

Page 10: Spring Rebooted

Service Discovery

Merchant

PaybackBuys

Reports

ReceivesCustomer

MerchantMerchant

CustomerCustomer

PaybackPayback

Registry

@dkaczynski#geecon

Page 11: Spring Rebooted

Source Code

Service Discovery

@dkaczynski#geecon

Page 12: Spring Rebooted

Service Discovery Server

● Netflix Eureka

○ locating services for the purpose of load balancing and failover of middle-tier servers

● Spring Cloud

○ spring-cloud-starter-eureka-server

○ @EnableEurekaServer

@dkaczynski#geecon

Page 13: Spring Rebooted

Central Configuration

Merchant

PaybackBuys

Reports

ReceivesCustomer

MerchantMerchant

CustomerCustomer

PaybackPayback

Registry

Config

@dkaczynski#geecon

Page 14: Spring Rebooted

Source Code

Confguration Server

@dkaczynski#geecon

Page 15: Spring Rebooted

Central Configuration Server

● Spring Cloud Config

○ externalized configuration in a distributed system

○ manage external properties for applications across all environments

○ concept identicall to the Environment and PropertySource abstractions

○ git as default implementation of the server storage backend

○ alternative implementations configurable

@dkaczynski#geecon

Page 16: Spring Rebooted

Source Code

Customer Service

@dkaczynski#geecon

Page 17: Spring Rebooted

Spring Data

● spring-boot-starter-data-*

○ jpa, mongodb, solr, gemfire, elasticsearch

● spring-data-*

○ neo4j, redis, hadoop, cassandra, jdbc, couchbase

● @Enable*Repositories

○ above apply, also @EnableSpringDataWebSupport

● interface Repository<T, ID extends Serializable>

○ common interface

@dkaczynski#geecon

Page 18: Spring Rebooted

Source Code

Merchant Service

@dkaczynski#geecon

Page 19: Spring Rebooted

Spring Data REST

● spring-boot-starter-data-rest

○ plug & play

● @RepositoryRestResource

○ configurable endoints

● Page<T> & Pageable

○ paging and sorting

● HATEOAS

○ links and metadata

@dkaczynski#geecon

Page 20: Spring Rebooted

Source Code

Payback Service

@dkaczynski#geecon

Page 21: Spring Rebooted

Service Discovery Client

● Spring Cloud

○ spring-cloud-starter-eureka-server

○ @EnableDiscoveryClient / @EnableEurekaClient

○ programatic access via DiscoveryClient

○ RestTemplate support

@dkaczynski#geecon

Page 22: Spring Rebooted

HTTP/REST Client

● Netflix Feign

○ java to http client binder

○ minimal overhead and code

○ customizable decoders and error handling

● Spring Cloud

○ spring-cloud-starter-feign

○ @EnableFeignClients

○ @FeignClient

○ @RequestMapping

@dkaczynski#geecon

Page 23: Spring Rebooted

Circuit Breaker

● Netflix Hystrix

○ latency and fault tolerance library

○ designed to isolate points of access to remote systems

○ stop cascading failure and enable resilience

● Spring Cloud

○ spring-cloud-starter-hystrix

○ @EnableCircuitBreaker

○ @HystrixCommand

@dkaczynski#geecon

Page 24: Spring Rebooted

Operations Dashboard

Merchant

PaybackBuys

Reports

ReceivesCustomer

MerchantMerchant

CustomerCustomer

PaybackPayback

Registry

Config

Dashboard

@dkaczynski#geecon

Page 25: Spring Rebooted

Source Code

Dashboard

@dkaczynski#geecon

Page 26: Spring Rebooted

Hystrix Dashboard

● Netflix Turbine

○ server side events stream aggregator

● Spring Cloud

○ spring-cloud-starter-hystrix-dashboard

○ @EnableHystrixDashboard

○ spring-cloud-starter-turbine

○ @EnableTurbine

@dkaczynski#geecon

Page 27: Spring Rebooted

Frontend Dispatcher

Merchant

PaybackBuys

Reports

ReceivesCustomer

MerchantMerchant

CustomerCustomer

PaybackPayback

Registry

Config

Dashboard

UI

Dispatcher

@dkaczynski#geecon

Page 28: Spring Rebooted

Source Code

Frontend Dispatcher

@dkaczynski#geecon

Page 29: Spring Rebooted

Frontend Dispatcher

● Netflix Zulu

○ front door for all requests from devices and web sites to the backend

● Spring Cloud

○ spring-cloud-starter-zuul

○ @EnableZuulProxy

@dkaczynski#geecon

Page 30: Spring Rebooted

Thank You

Links:

● https://spring.io/

● https://spring.io/videos

● https://github.com/kaczynskid/geecon-spring-lab

● https://github.com/kaczynskid/geecon-spring-lab-config

● https://github.com/spring-cloud-samples

● https://github.com/spring-cloud-samples/springbox-cloud

● https://github.com/joshlong/devoxx-poland-2015-microservices-hol

@dkaczynski#geecon