Book description
Create and deploy production-quality microservices-based applications — New edition updated for the smooth running of Spring, Java, Kubernetes, and Istio, with an introduction to Helm 3 and support for Mac and Windows with WSL2
Key Features
- Build cloud-native production-ready microservices with this comprehensively updated guide
- Understand the challenges of building large-scale microservice architectures
- Learn how to get the best out of Spring Cloud, Kubernetes, and Istio in combination
Book Description
Want to build and deploy microservices, but don't know where to start? Welcome to Microservices with Spring Boot and Spring Cloud.
This edition features the most recent versions of Spring, Java, Kubernetes, and Istio, demonstrating faster and simpler handling of Spring Boot, local Kubernetes clusters, and Istio installation. The expanded scope includes native compilation of Spring-based microservices, support for Mac and Windows with WSL2, and an introduction to Helm 3 for packaging and deployment. A revamped security chapter now follows the OAuth 2.1 specification and makes use of the newly launched Spring Authorization Server from the Spring team.
You'll start with a set of simple cooperating microservices, then add persistence and resilience, make your microservices reactive, and document their APIs using OpenAPI.
Next, you'll learn how fundamental design patterns are applied to add important functionality, such as service discovery with Netflix Eureka and edge servers with Spring Cloud Gateway. You'll deploy your microservices using Kubernetes and adopt Istio, then explore centralized log management using the Elasticsearch, Fluentd, and Kibana (EFK) stack, and then monitor microservices using Prometheus and Grafana.
By the end of this book, you'll be building scalable and robust microservices using Spring Boot and Spring Cloud.
What you will learn
- Build reactive microservices using Spring Boot
- Develop resilient and scalable microservices using Spring Cloud
- Use OAuth 2.1/OIDC and Spring Security to protect public APIs
- Implement Docker to bridge the gap between development, testing, and production
- Deploy and manage microservices with Kubernetes
- Apply Istio for improved security, observability, and traffic management
- Write and run automated microservice tests with JUnit, testcontainers, Gradle, and bash
Who this book is for
If you're a Java or Spring Boot developer learning how to build microservice landscapes from scratch, then this book is for you. You don't need any prior knowledge about microservices architecture to get started, but a solid grasp and enough experience in Java and Spring Boot to build apps autonomously is a must.
Table of contents
- Preface
-
Part I: Getting Started with Microservice Development Using Spring Boot
-
Introduction to Microservices
- Technical requirements
- My way into microservices
- Defining a microservice
- Challenges with microservices
- Design patterns for microservices
- Software enablers
- Other important considerations
- Summary
- Introduction to Spring Boot
-
Creating a Set of Cooperating Microservices
- Technical requirements
- Introducing the microservice landscape
- Generating skeleton microservices
- Adding RESTful APIs
- Adding a composite microservice
- Adding error handling
- Testing APIs manually
- Adding automated microservice tests in isolation
- Adding semi-automated tests of a microservice landscape
- Summary
- Questions
- Deploying Our Microservices Using Docker
- Adding an API Description Using OpenAPI
-
Adding Persistence
- Technical requirements
- Chapter objectives
- Adding a persistence layer to the core microservices
- Writing automated tests that focus on persistence
- Using the persistence layer in the service layer
- Extending the composite service API
- Adding databases to the Docker Compose landscape
- Manual tests of the new APIs and the persistence layer
- Updating the automated tests of the microservice landscape
- Summary
- Questions
-
Developing Reactive Microservices
- Technical requirements
- Choosing between non-blocking synchronous APIs and event-driven asynchronous services
- Developing non-blocking synchronous REST APIs
- Developing event-driven asynchronous services
- Running manual tests of the reactive microservice landscape
- Running automated tests of the reactive microservice landscape
- Summary
- Questions
-
Introduction to Microservices
-
Part II: Leveraging Spring Cloud to Manage Microservices
-
Introduction to Spring Cloud
- Technical requirements
- The evolution of Spring Cloud
- Using Netflix Eureka for service discovery
- Using Spring Cloud Gateway as an edge server
- Using Spring Cloud Config for centralized configuration
- Using Resilience4j for improved resilience
- Using Spring Cloud Sleuth and Zipkin for distributed tracing
- Summary
- Questions
- Adding Service Discovery Using Netflix Eureka
- Using Spring Cloud Gateway to Hide Microservices behind an Edge Server
-
Securing Access to APIs
- Technical requirements
- Introduction to OAuth 2.0 and OpenID Connect
- Securing the system landscape
- Protecting external communication with HTTPS
- Securing access to the discovery server
- Adding a local authorization server
- Protecting APIs using OAuth 2.0 and OpenID Connect
- Testing with the local authorization server
-
Testing with an external OpenID Connect provider
- Setting up and configuring an account in Auth0
- Applying the required changes to use Auth0 as an OpenID provider
- Running the test script with Auth0 as the OpenID Connect provider
- Acquiring access tokens using the client credentials grant flow
- Acquiring access tokens using the authorization code grant flow
- Calling protected APIs using the Auth0 access tokens
- Getting extra information about the user
- Summary
- Questions
- Centralized Configuration
-
Improving Resilience Using Resilience4j
- Technical requirements
- Introducing the Resilience4j resilience mechanisms
- Adding the resilience mechanisms to the source code
- Trying out the circuit breaker and retry mechanism
- Summary
- Questions
- Understanding Distributed Tracing
-
Introduction to Spring Cloud
-
Part III: Developing Lightweight Microservices Using Kubernetes
- Introduction to Kubernetes
-
Deploying Our Microservices to Kubernetes
- Technical requirements
- Replacing Netflix Eureka with Kubernetes Services
- Introducing how Kubernetes will be used
- Using Spring Boot's support for graceful shutdown and probes for liveness and readiness
- Introducing Helm
- Deploying to Kubernetes for development and test
- Deploying to Kubernetes for staging and production
- Summary
- Questions
- Implementing Kubernetes Features to Simplify the System Landscape
-
Using a Service Mesh to Improve Observability and Management
- Technical requirements
- Introducing service meshes using Istio
- Simplifying the microservice landscape
- Deploying Istio in a Kubernetes cluster
- Creating the service mesh
- Observing the service mesh
- Securing a service mesh
- Ensuring that a service mesh is resilient
- Performing zero-downtime updates
- Running tests with Docker Compose
- Summary
- Questions
- Centralized Logging with the EFK Stack
-
Monitoring Microservices
- Technical requirements
- Introduction to performance monitoring using Prometheus and Grafana
- Changes in source code for collecting application metrics
- Building and deploying the microservices
- Monitoring microservices using Grafana dashboards
- Setting up alarms in Grafana
- Summary
- Questions
- Installation Instructions for macOS
- Installation Instructions for Microsoft Windows with WSL 2 and Ubuntu
-
Native Compiled Java Microservices
- Technical requirements
- When to native compile Java source code
- Introducing the GraalVM project
- Introducing the Spring Native project
- Compiling source code to a native image
- Testing with Docker Compose
- Testing with Kubernetes
- Summary
- Questions
- Other Books You May Enjoy
- Index
Product information
- Title: Microservices with Spring Boot and Spring Cloud - Second Edition
- Author(s):
- Release date: July 2021
- Publisher(s): Packt Publishing
- ISBN: 9781801072977
You might also like
video
Master Microservices with Spring Boot and Spring Cloud
Beginning with the basics, this course covers the core principles of microservices architecture, contrasting it with …
book
Microservices with Spring Boot 3 and Spring Cloud - Third Edition
Create and deploy production-grade microservices-based applications with this latest edition updated to Spring Boot 3, Java …
book
Hands-On Microservices with Spring Boot and Spring Cloud
Apply microservices patterns to build resilient and scalable distributed systems Key Features Understand the challenges of …
video
Building Microservices with Spring Boot, Second Edition
7+ Hours of Video Instruction The term “microservices” has gained significant traction over the last few …