Learn Microservices with Spring Boot (Second edition)

Learn Microservices with Spring Boot (Second edition)

Table of Contents

Hi! Looking for the extra contents? Jump directly to that section.

In 2017, I wrote the book Learn Microservices with Spring Boot (1st ed.). I got a lot of feedback since then. Some technologies used in the book have evolved or have been replaced by others. Besides, I learned new topics, and came up with better ideas to structure the contents of a new book.

The result of this revision is the book’s Second Edition, a book where I take you through the journey of building a microservice architecture from scratch, using best practices, and looking at it from a hands-on perspective.

You can buy the book from your favorite online or physical store. The ISBN-13 codes are 9781484261309 for the Paperback edition and 9781484261316 for the e-book version. Here are some links to popular online stores:

Book’s contents

The best way to find out what’s included in the book is to watch the Book Summary on YouTube:

Not a fan of watching videos? Then, just continue reading for more information.

  • Build microservices with Spring Boot using a 3-tier, 3-layer design.
  • Learn about TDD techniques and what their benefits are.
  • Compare synchronous vs. asynchronous communication to connect microservices. See how they relate to eventual consistency.
  • Use an event-driven architecture. Implement resilience and scalability with RabbitMQ.
  • Master service discovery with Consul and load balancing with Spring Cloud Load Balancer
  • Route requests with Spring Cloud Gateway.
  • Keep flexible configurations per environment with Spring Cloud Consul.
  • Trace every request from beginning to end with Sleuth and centralized logging.
  • Deploy your microservices anywhere as Docker containers with Buildpacks.
  • Start all the components in the microservice architecture with Docker Compose.
  • Learn how to achieve your non-functional requirements with practical case studies for scalability, fault-tolerance, retries, etc.
  • As a side track, learn how to build simple frontend interfaces with React.

The full table of contents is included below. All the source code included in the book is also available on GitHub. The links to the repositories are next to the chapter’s titles in the table of contents.

The practical case study

All the contents in the book are presented around a practical case study, that evolves each chapter with the introduction of new concepts.

You start with a small monolith, looking at the best design practices, and you learn how Spring Boot works with real examples.

Then, you introduce a second microservice in the system, and study the differences between synchronous and asynchronous communication. That’s how you get to Event-Driven architectures. Once you enter into the world of microservices, you must learn the most important architecture patterns for distributed systems: Gateway, Service Discovery, Load Balancing, Resilience, Scalability, Distributed Tracing, etc.

The book's practical case study - Component View

The Book’s ToC

Here you can have a sneak peek at the Book’s Table of Contents:

  1. Introduction
    1. Setting the scene
    2. Who are you?
    3. How is this book different from others?
    4. Contents
    5. Online Contents
  2. Core concepts
    1. Spring
    2. Spring Boot
    3. Lombok and Java
    4. Testing basics: TDD, BDD, JUnit, Mockito, AssertJ
    5. Testing in Spring Boot
    6. Logging
    7. Summary
  3. A basic Spring Boot app (+ GitHub Repo)
    1. Intro
    2. Business Requirements
    3. Setting up the development environment
    4. The Skeleton Web App
    5. Spring Boot Auto-Configuration (check the blog post)
    6. Three-tier, Three-layer Architecture
    7. Modeling our domain
    8. Business logic
    9. The Presentation Layer
    10. Summary
  4. A minimal frontend with React (+ GitHub Repo)
    1. Quick intro to React and Node
    2. Setting up the development environment
    3. The React app skeleton
    4. A JavaScript REST Client
    5. The Challenge Component
    6. Running our frontend for the first time
    7. Debugging
    8. Adding CORS configuration
    9. Playing with the app
    10. Deploying the frontend
    11. Summary
  5. The data layer (+ GitHub Repo)
    1. Intro
    2. The Data Model
    3. Choosing a database
    4. Spring Boot Data JPA
    5. Entities
    6. Repositories
    7. Storing users and attempts
    8. New APIs and UI
    9. Playing with the new feature
    10. Summary
  6. Starting with Microservices (+ GitHub Repo)
    1. Intro: what happened until now
    2. The Small Monolith approach
    3. New requirements and Gamification
    4. When should we move to microservices?
    5. Why microservices?
    6. Architecture Overview
    7. Designing and implementing the new microservice
    8. Playing with the system
    9. Fault Tolerance
    10. The challenges ahead
    11. Summary
  7. Event-Driven Architecture (+ GitHub Repo)
    1. Core Concepts
    2. Pros and Cons of Event-Driven
    3. Messaging Patterns
    4. Message Broker Protocols, Standards and Tools
    5. AMQP and RabbitMQ
    6. Setting up RabbitMQ
    7. Spring AMQP and Spring Boot
    8. Solution Design
    9. Analysis: happy flow, resilience, and scalability.
    10. Summary
  8. Common Patterns in Microservice Architectures (+ GitHub Repo)
    1. Gateway
    2. Health
    3. Service Discovery & Load Balancing (+ GitHub Repo)
    4. Configuration per Environment (+ GitHub Repo)
    5. Centralized Logs
    6. Distributed Tracing
    7. Containerization (+ GitHub Repo)
    8. Platforms and Cloud-Native Microservices
    9. Summary
  9. Foreword

Book’s extra chapters

For this second edition, I’m creating book extensions that give you extra insights on other topics not included in the book. Subscribe to the newsletter to get the latest posts and guides.

Book's Icon
In this online guide, you'll learn how to create end-to-end tests to verify the functionality from solving challenges to getting score and badges.
Book's Icon
Step-by-step migration guide from Spring Boot 2.3 to Spring Boot 2.4 for the book's microservice architecture project.
Book's Icon
Step-by-step migration guide from Spring Boot 2.4 to Spring Boot 2.5.5 for the book's project.
Book's Icon
Step-by-step migration guide from Spring Boot 2.5 to Spring Boot 2.6 for the book's project.
Book's Icon
Step-by-step migration guide from Spring Boot 2.6 to Spring Boot 2.7 for the book's project.

Questions about the book

Do you have questions about the book? Feel free to ask!

  • For general questions about the book: please use Goodreads’ book page. Alternatively, you can post a comment on this page.
  • Did you find any broken link? That may happen, please let me know via comment on this page, Goodreads, or Twitter.
  • Questions about the source code? Are you stuck? Don’t worry, I can help. Just open an issue on the corresponding Github repository. Not sure where? Just use the last chapter’s issues page.

Supporting the author

Did you like the book? That’s great, I’m glad I helped you learn something new. If you want to help me spread the word and make this book reach more people, you can: