Learn Microservices with Spring Boot: A Practical Approach to Restful Services Using an Event-Driven Architecture, Cloud-Native Patterns, and Containe

Macero García, Moisés



Build Java-based microservices architecture using the Spring Boot framework by evolving an application from a small monolith to an event-driven architecture composed of several services. This revised book follows an incremental approach in teaching the structure of microservices, test-driven development, and common patterns in distributed systems such as service discovery, load balancing, routing, centralized logs, per-environment configuration, and containerization.
This updated book now covers what's been added to the latest Spring Boot release, including support for the latest Java SE; more deep-dive knowledge on how Spring Boot works; testing with JUnit 5; changes in the Spring Cloud tools used for service discovery and load balancing; building Docker images using cloud-native buildpacks; a basic centralized logging solution; E2E traceability with Sleuth; centralized configuration with Consul; many dependency upgrades; support for Spring Data Neumann; and more.

Author Moises Macero uses a pragmatic approach to explain the benefits of using this type of software architecture, instead of keeping you distracted with theoretical concepts. He covers some of the state-of-the-art techniques in computer programming, from a practical point of view. You'll focus on what's important, starting with the minimum viable product but keeping the flexibility to evolve it.

What You Will Learn

  • Build microservices with Spring Boot
  • Discover architecture patterns for distributed systems such as asynchronous processing, eventual consistency, resilience, scalability, and more
  • Use event-driven architecture and messaging 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
  • Start all the components in the microservice architecture with Docker Compose

Who This Book Is For
Those with at least some prior experience with Java programming. Some prior exposure to Spring Boot recommended but not required.


使用Spring Boot框架建立基於Java的微服務架構,將一個小型單體應用程式進化為由多個服務組成的事件驅動架構。這本修訂版的書籍以漸進的方式教授微服務的結構、測試驅動開發以及分散式系統中的常見模式,如服務發現、負載平衡、路由、集中式日誌、環境配置和容器化。

這本更新的書籍現在包含了最新的Spring Boot版本所新增的功能,包括對最新的Java SE的支援;更深入的Spring Boot工作原理知識;使用JUnit 5進行測試;Spring Cloud工具中用於服務發現和負載平衡的變化;使用雲原生Buildpacks建立Docker映像;基本的集中式日誌解決方案;使用Sleuth進行端到端的追蹤;使用Consul進行集中式配置;許多依賴升級;對Spring Data Neumann的支援等等。

作者Moises Macero以實用的方式解釋了使用這種軟體架構的好處,而不是讓你分心於理論概念。他從實際角度介紹了一些計算機編程的最新技術。你將專注於重要的事情,從最小可行產品開始,但保持靈活性以進行演進。

- 使用Spring Boot建立微服務
- 探索分散式系統的架構模式,如異步處理、最終一致性、彈性和可擴展性等
- 使用RabbitMQ實現事件驅動架構和消息傳遞
- 使用Consul進行服務發現,使用Spring Cloud Load Balancer進行負載平衡
- 使用Spring Cloud Gateway進行請求路由
- 使用Spring Cloud Consul在每個環境中保持靈活的配置
- 使用Sleuth和集中式日誌追蹤每個請求的整個過程
- 將你的微服務部署為Docker容器
- 使用Docker Compose啟動微服務架構中的所有組件

適合對Java編程有一定經驗的讀者閱讀。建議但不要求有一些Spring Boot的先前經驗。


Moisés Macero García has been a software developer since he was a kid, when he started playing around with BASIC on his ZX Spectrum. During his career, Moisés has most often worked in development and architecture for small and large projects, and for his own startups as well. He enjoys making software problems simple, and he likes working in teams where he can not only coach others, but also learn from them.

Moisés is the author of the blog thepracticaldeveloper.com, where he shares solutions for technical challenges, guides, and his view on different ways of working in IT companies. He also organizes workshops for companies that need a practical approach to software engineering. In his free time, he enjoys traveling and hiking.



Moisés Macero García自小就是一名軟體開發者,從他在ZX Spectrum上玩BASIC開始。在他的職業生涯中,Moisés大多數時間都在小型和大型項目的開發和架構方面工作,也為自己的創業公司工作。他喜歡將軟體問題簡化,並喜歡在團隊中工作,不僅可以指導他人,還可以從他人身上學習。