Skip to content

Learn Microservices with Spring Boot

A Practical Approach to Distributed Systems (2nd Edition)

This book presents an evolutionary and practical approach to distributed software architectures. Learn how to transition from a monolithic system to a microservices-based architecture while avoiding common pitfalls.

📖 350+ pages • ⭐ 4.5/5 rating • 🔄 2nd Edition (2020) • 💻 Full code examples

Master Microservices Step by Step

This book takes you through a practical journey, building real microservices while learning the patterns and practices that matter.

Practical Evolution

Start with a monolith (the best option to begin) and evolve to microservices when needed.

Spring Boot Mastery

Build microservices with Spring Boot using 3-tier, 3-layer design patterns.

Event-Driven Architecture

Implement resilience and scalability with RabbitMQ and asynchronous communication.

Cloud Patterns

Master service discovery with Consul, load balancing, and Spring Cloud Gateway.

Observability

Trace requests with Sleuth, implement centralized logging, and monitoring.

Containerization

Deploy microservices as Docker containers with Buildpacks and Docker Compose.

Learn by Building a Real System

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, and more.

  • Start with a monolith
  • Evolve to microservices
  • Learn patterns in practice
  • Build real solutions
Microservices architecture diagram from the book

Comprehensive Coverage

Chapter 1

Introduction

Setting the scene for microservices and understanding the approach of this book.

  • Setting the scene
  • Who are you?
  • How is this book different from others?
  • Contents
  • Online Contents
Chapter 2

Core Concepts

Spring Boot fundamentals and testing strategies that will be used throughout the book.

  • Spring
  • Spring Boot
  • Lombok and Java
  • Testing basics: TDD, BDD, JUnit, Mockito, AssertJ
  • Testing in Spring Boot
  • Logging
  • Summary
Chapter 3

A Basic Spring Boot App

Building the foundation application with proper architecture patterns.

  • Intro
  • Business Requirements
  • Setting up the development environment
  • The Skeleton Web App
  • Spring Boot Auto-Configuration
  • Three-tier, Three-layer Architecture
  • Modeling my domain
  • Business logic
  • The Presentation Layer
  • Summary
Chapter 4

A Minimal Frontend with React

Creating a user interface to interact with my Spring Boot backend.

  • Quick intro to React and Node
  • Setting up the development environment
  • The React app skeleton
  • A JavaScript REST Client
  • The Challenge Component
  • Running my frontend for the first time
  • Debugging
  • Adding CORS configuration
  • Playing with the app
  • Deploying the frontend
  • Summary
Chapter 5

The Data Layer

Implementing persistence with Spring Data JPA and best practices.

  • Intro
  • The Data Model
  • Choosing a database
  • Spring Boot Data JPA
  • Entities
  • Repositories
  • Storing users and attempts
  • New APIs and UI
  • Playing with the new feature
  • Summary
Chapter 6

Starting with Microservices

Moving from monolith to microservices architecture with practical examples.

  • Intro: what happened until now
  • The Small Monolith approach
  • New requirements and Gamification
  • When should I move to microservices?
  • Why microservices?
  • Architecture Overview
  • Designing and implementing the new microservice
  • Playing with the system
  • Fault Tolerance
  • The challenges ahead
  • Summary
Chapter 7

Event-Driven Architecture

Implementing asynchronous communication with RabbitMQ and Spring AMQP.

  • Core Concepts
  • Pros and Cons of Event-Driven
  • Messaging Patterns
  • Message Broker Protocols, Standards and Tools
  • AMQP and RabbitMQ
  • Setting up RabbitMQ
  • Spring AMQP and Spring Boot
  • Solution Design
  • Analysis: happy flow, resilience, and scalability
  • Summary

Common Patterns in Microservice Architectures

Essential patterns for building robust microservice systems.

  • Gateway
  • Health
  • Service Discovery & Load Balancing
  • Configuration per Environment
  • Centralized Logs
  • Distributed Tracing
  • Containerization
  • Platforms and Cloud-Native Microservices
  • Summary
Chapter 9

Foreword

Final thoughts and next steps in your microservices journey.

Learn Microservices with Spring Boot book cover
Paperback ISBN: 9781484261309
E-book ISBN: 9781484261316

Get Your Copy

Available in paperback and e-book formats from your favorite bookstore.

Want Training Based on This Book?