Spring Microservices in Action, Second Edition
John Carnell, Illary Huaylupo Sánchez
  • MEAP began November 2019
  • Publication in Early 2021 (estimated)
  • ISBN 9781617296956
  • 425 pages (estimated)
  • printed in black & white
free previous edition eBook included
An eBook copy of the previous edition of this book is included at no additional cost. It will be automatically added to your Manning Bookshelf within 24 hours of purchase.

Genuinely impressed with the way that topics were introduced and the context of the solutions proposed.

Alex Lucas
By dividing large applications into separate self-contained units, Microservices are a great step toward reducing complexity and increasing flexibility. Spring Microservices in Action, Second Edition teaches you how to build microservice-based applications using Java and the Spring platform. This second edition is fully updated for the latest version of Spring, with expanded coverage of API routing with Spring Cloud Gateway, logging with the ELK stack, metrics with Prometheus and Grafana, security with the Hashicorp Vault, and modern deployment practices with Kubernetes and Istio.

About the Technology

Microservices break up your code into independent interconnected services that require careful forethought and design. Fortunately, Spring Boot, Spring Cloud, and Spring Cloud Gateway simplify the tedious plumbing and infrastructure setup required for microservice applications. Spring Boot removes the boilerplate code involved with writing a REST-based service. Spring Cloud provides a suite of tools for the discovery, routing, and deployment of microservices to the enterprise and the cloud. Spring Cloud Gateway provides a clear and effective routing to APIs, with a single entry point into a system. Together, they make it a snap to spin up Spring applications as microservices and wire them together into a reliable, scalable system.

About the book

Fully updated and upgrade for the latest version of Spring, Spring Microservices in Action, Second Edition is an expanded revision of a Manning bestseller. In it, you’ll learn how to build microservice-based applications using Java and the Spring platform and how to efficiently monitor and log your microservices operations. Throughout the book, carefully selected real-life examples expose microservice-based patterns for configuring, routing, scaling, and deploying your services. You'll see how Spring's intuitive tooling can help augment and refactor existing applications with microservices and how Spring Cloud Gateway makes it easy to handle multiple APIs with a single tool. You’ll also pick up best practices for using Spring with modern deployment platforms based on Kubernetes and Istio.
Table of Contents detailed table of contents

1 Welcome to the cloud, Spring

1.1 The evolution towards a microservices architecture

1.1.1 What’s a monolithic architecture?

1.1.2 What’s a microservice?

1.1.3 Why change the way we build applications?

1.2 Microservices with Spring

1.3 What is this book about?

1.3.1 What you’ll learn in this book

1.3.2 Why is this book relevant to you?

1.4 Cloud and microservice-based applications

1.4.1 Building a microservice with Spring Boot

1.4.2 What exactly is cloud computing?

1.4.3 Why the cloud and microservices?

1.5 Microservices are more than writing the code

1.6 Core microservice development pattern

1.7 Microservice routing patterns

1.8 Microservice client resiliency

1.9 Microservice security patterns

1.10 Microservice logging and tracing patterns

1.11 Application metrics pattern

1.12 Microservice build/deployment patterns

1.13 What is Spring Cloud?

1.13.1 Spring Cloud Config

1.13.2 Spring Cloud Service Discovery

1.13.3 Spring Cloud/Netflix Hystrix and Ribbon

1.13.4 Spring Cloud API Gateway

1.13.5 Spring Cloud Stream

1.13.6 Spring Cloud Sleuth

1.13.7 Spring Cloud Security

1.14 Spring Cloud by example

1.15 Summary

2 Exploring the microservices world with Spring Cloud

2.1 How to build a cloud-native microservice?

2.1.1 Code Base

2.1.2 Dependencies

2.1.3 Config

2.1.4 Backing services

2.1.5 Build, release, run

2.1.6 Processes

2.1.7 Port binding.

2.1.8 Concurrency

2.1.9 Disposability

2.1.10 Dev/prod parity

2.1.11 Logs

2.1.12 Admin processes

2.2 Microservice Architecture best practices

2.2.1 Richardson level of maturity

2.2.2 Spring HATEOAS

2.2.3 Externalized configuration

2.2.4 Continuous Integration and Continuous delivery

2.2.5 Monitoring

2.2.6 Logging

2.2.7 API Gateways

2.3 Summary

3 Building microservices with Spring Boot

3.1 Making sure our examples are relevant

3.2 The architect’s story: designing the microservice architecture

3.2.1 Decomposing the business problem

3.2.2 Establishing service granularity

3.2.3 Defining the service interfaces

3.3 When not to use microservices

3.3.1 Complexity of building distributed systems

3.3.2 Server sprawl

3.3.3 Type of application

3.3.4 Data transactions and consistency

3.4 The developer’s tale: building a microservice with Spring Boot and Java

3.4.1 Setting up the environment

3.4.2 Getting started with the skeleton project

3.4.3 Booting your Spring Boot application: Writing the Bootstrap class

3.4.4 Building the doorway into the microservice: The Spring Boot controller

3.4.5 Applying internationalization into the licensing service

3.5 The DevOps story: building for the rigors of runtime

3.5.1 Service assembly: packaging and deploying your microservices

3.5.2 Service bootstrapping: managing configuration of your microservices

3.5.3 Service registration and discovery: how clients communicate with your microservices

3.5.4 Communicating a microservice’s health

3.6 Pulling the perspectives together

3.7 Summary

4 Welcome to Docker

4.1 Containers or virtual machines?

4.2 What is Docker?

4.3 Dockerfiles

4.3.1 Dockerfile commands

4.4 Docker compose

4.4.1 Docker-compose commands

4.5 Integrating docker with our microservices

4.5.1 Building the Docker Image

4.5.2 Launching the services with Docker Compose

4.6 Summary

5 Controlling your configuration with Spring Cloud configuration server

5.1 On managing configuration (and complexity)

5.1.1 Your configuration management architecture

5.1.2 Implementation choices

5.2 Building our Spring Cloud configuration server

5.2.1 Setting up the Spring Cloud Config Bootstrap class

5.2.2 Using Spring Cloud configuration server with the filesystem

5.2.3 Setting up the configuration files for a service

5.3 Integrating Spring Cloud Config with a Spring Boot client

5.3.1 Setting up the licensing service Spring Cloud Config service dependencies

5.3.2 Configuring the licensing service to use Spring Cloud Config

5.3.3 Wiring in a data source using Spring Cloud configuration server

5.3.4 Directly reading properties using the @Value annotation

5.3.5 Refreshing your properties using Spring Cloud configuration server

5.3.6 Using Spring Cloud configuration server with Git

5.3.7 Integrating Vault with Spring Cloud Config service

5.3.8 Vault UI

5.4 Protecting sensitive configuration information

5.4.1 Setting up a symmetric encryption key

5.4.2 Encrypting and decrypting a property

5.5 Closing thoughts

5.6 Summary

6 On service discovery

6.1 Where’s my service?

6.2 On service discovery in the cloud

6.2.1 The architecture of service discovery

6.2.2 Service discovery in action using Spring and Netflix Eureka

6.3 Building our Spring Eureka Service

6.4 Registering services with Spring Eureka

6.4.1 Eureka’s REST API

6.4.2 Eureka dashboard

6.5 Using service discovery to look up a service

6.5.1 Looking up service instances with Spring Discovery Client

6.5.2 Invoking services with Ribbon-aware Spring RestTemplate

6.5.3 Invoking services with Netflix Feign client

6.6 Summary

7 When bad things happen: client resiliency patterns with Spring Cloud and Netflix Hystrix

7.1 What are client-side resiliency patterns?

7.1.1 Client-side load balancing

7.1.2 Circuit Breaker

7.1.3 Fallback processing

7.1.4 Bulkheads

7.2 Why client resiliency matters?

7.3 Implementing Hystrix

7.4 Setting up the licensing server to use Spring Cloud and Hystrix

7.5 Implementing a circuit breaker using Hystrix

7.5.1 Timing out a call to the organization microservice

7.5.2 Customizing the timeout on a circuit breaker

7.6 Fallback processing

7.7 Implementing the bulkhead pattern

7.8 Getting beyond the basics; fine-tuning Hystrix

7.8.1 Externalize Hystrix Parameters

7.8.2 Hystrix configuration revisited

7.9 Thread context and Hystrix

7.9.1 ThreadLocal and Hystrix

7.9.2 The HystrixConcurrencyStrategy in action

7.10 Summary

8 Service routing with Spring Cloud Gateway

8.1 What is a services gateway?

8.2 Introducing Spring Cloud Gateway

8.2.1 Setting up the Gateway Spring Boot project

8.2.2 Configuring the Spring Cloud Gateway to communicate with Eureka

8.3 Configuring routes in Spring Cloud Gateway

8.3.1 Automated mapping of routes via service discovery

8.3.2 Mapping routes manually using service discovery

8.3.3 Dynamically reload route configuration

8.3.4 Spring Cloud Gateway and service timeouts

8.4 The real power of the Spring Cloud Gateway: predicate and filters factories

8.4.1 Built-in Predicates Factories

8.4.2 Built-in Filters Factories

8.4.3 Custom Filters

8.5 Building the pre-filter

8.5.1 Using the correlation ID in the services

8.6 Building a post filter receiving correlation IDs

8.7 Summary

9 Securing your microservices

10 Event-driven architecture with Spring Cloud Stream.

11 Distributed tracing with Spring Cloud Sleuth and Zipkin

12 Deploying your microservices

13 Istio as Service Mesh

Appendix A: Running a cloud on your desktop

Appendix B: OAuth2 grant types

Appendix C: Implementing Spring Cloud Consul

Appendix D: Implementing Spring Cloud Zookeeper

What's inside

  • Core microservice design principles
  • Microservices best practices
  • Using docker containers to run microservices
  • Managing configuration with Spring Cloud Config and Hashicorp Vault for sensitive information
  • Client-side resiliency with Hystrix, and Ribbon
  • Managing application metrics with Prometheus and Grafana
  • Intelligent routing using Spring Cloud Gateway
  • Distributed tracing with Spring Cloud Sleuth, Zipkin and ELK Stack
  • Deploying Spring Cloud applications with Kubernetes and Istio

About the reader

This book is written for developers with Java and Spring experience.

About the authors

John Carnell is a senior cloud engineer with twenty years of experience in Java. Illary Huaylupo Sánchez is a software engineer with an MBA in IT management and over twelve years of experience in Java.

placing your order...

Don't refresh or navigate away from the page.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
print book $29.99 $49.99 pBook + eBook + liveBook
includes previous edition eBook
Additional shipping charges may apply
Spring Microservices in Action, Second Edition (print book) added to cart
continue shopping
go to cart

eBook $24.99 $39.99 3 formats + liveBook
includes previous edition eBook
Spring Microservices in Action, Second Edition (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks