Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Hands-On Microservices with Spring Boot and Spring Cloud
Hands-On Microservices with Spring Boot and Spring Cloud

Hands-On Microservices with Spring Boot and Spring Cloud: Build and deploy Java microservices using Spring Cloud, Istio, and Kubernetes

eBook
$32.99 $47.99
Paperback
$59.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Microservices with Spring Boot and Spring Cloud

Introduction to Microservices

This book does not blindly praise microservices. Instead, it's about how we can use their benefits while being able to handle the challenges of building scalable, resilient, and manageable microservices.

As an introduction to this book, the following topics will be covered in this chapter:

  • How I learned about microservices and what experience I have of their benefits and challenges
  • What is a microservice-based architecture?
  • Challenges with microservices
  • Design patterns for handling challenges
  • Software enablers that can help us handle these challenges
  • Other important considerations that aren't covered in this book

Technical requirements

No installations are required for this chapter. However, you may be interested in taking a look at the C4 model conventions, https://c4model.com, since the illustrations in this chapter are inspired by the C4 model.

This chapter does not contain any source code.

My way into microservices

When I first learned about the concept of microservices back in 2014, I realized that I had been developing microservices (well, kind of) for a number of years without knowing it was microservices I was dealing with. I was involved in a project that started in 2009 where we developed a platform based on a set of separated features. The platform was delivered to a number of customers that deployed it on-premise. To make it easy for the customers to pick and choose what features they wanted to use from the platform, each feature was developed as an autonomous software component; that is, it had its own persistent data and only communicated with other components using well-defined APIs.

Since I can't discuss specific features in this project's platform, I have generalized the names of the components, which are labeled from Component A ...

Defining a microservice

To me, a microservice architecture is about splitting up monolithic applications into smaller components, which achieves two major goals:

  • Faster development, enabling continuous deployments
  • Easier to scale, manually or automatically

A microservice is essentially an autonomous software component that is independently upgradeable and scalable. To be able to act as an autonomous component, it must fulfill certain criteria as follows: 

  • It must conform to a shared-nothing architecture; that is, microservices don't share data in databases with each other!
  • It must only communicate through well-defined interfaces, for example, using synchronous services or preferably by sending messages to each other using APIs and message formats that are stable, well-documented, and evolve by following a defined versioning strategy.
  • It must be deployed...

Challenges with microservices

In the Challenges with autonomous software components section, we have already seen some of the challenges that autonomous software components can bring (and they all apply to microservices as well) as follows:

  • Many small components that use synchronous communication can cause a chain of failure problem, especially under high load.
  • Keeping the configuration up to date for many small components can be challenging.
  • It's hard to track a request that's being processed and involves many components, for example, when performing root cause analysis, where each component stores log events locally.
  • Analyzing the usage of hardware resources on a component level can be challenging as well.
  • Manual configuration and management of many small components can become costly and error-prone.

Another downside...

Design patterns for microservices

This topic will cover using design patterns to mitigate challenges with microservices, as described in the preceding section. Later in this book, we will see how we can implement these design patterns using Spring Boot, Spring Cloud, and Kubernetes.

The concept of design patterns is actually quite old; it was invented by Christopher Alexander back in 1977. In essence, a design pattern is about describing a reusable solution to a problem when given a specific context.  

The design patterns we will cover are as follows: 

  • Service discovery
  • Edge server
  • Reactive microservices
  • Central configuration
  • Centralized log analysis
  • Distributed tracing
  • Circuit Breaker
  • Control loop
  • Centralized monitoring and alarms
This list is not intended to be comprehensive; instead, it's a minimal list of design patterns that are required...

Software enablers

As we've already mentioned, we have a number of very good open-source tools that can help us both meet our expectations of microservices and, most importantly, handle the new challenges that come with them:

  • Spring Boot
  • Spring Cloud/Netflix OSS
  • Docker
  • Kubernetes
  •  Istio (a service mesh)

The following table maps the design patterns we will need to handle these challenges, along with the corresponding open-source tool that implements the design pattern:

Design Pattern Spring Boot Spring Cloud Kubernetes Istio

Service discovery

Netflix Eureka and Netflix Ribbon Kubernetes kube-proxy and service resources

Edge server

Spring Cloud and Spring Security OAuth Kubernetes Ingress controller Istio ingress gateway

Reactive microservices

Spring Reactor and Spring WebFlux

Central configuration

Spring Config Server Kubernetes ConfigMaps...

Technical requirements

This chapter does not contain any source code that can be downloaded, nor does it require any tools to be installed.

Learning about Spring Boot

Spring Boot, and the Spring Framework that Spring Boot is based on, is a great framework for developing microservices in Java.

When the Spring Framework was released in v1.0 back in 2004, it was released in order to fix the overly complex J2EE standard (short for Java 2 Platforms, Enterprise Edition) with its infamous and heavyweight deployment descriptors. Spring Framework provided a much more lightweight development model based on the concept of dependency injection (DI). Spring Framework also used far more lightweight XML configuration files compared to the deployment descriptors in J2EE.

To make things even worse with the J2EE standard, the heavyweight deployment descriptors actually came in two types:
  • Standard deployment descriptors, describing the configuration in a standardized way
  • Vendor-specific deployment descriptors...
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand the challenges of building large-scale microservice landscapes
  • Build cloud-native production-ready microservices with this comprehensive guide
  • Discover how to get the best out of Spring Cloud, Kubernetes, and Istio when used together

Description

Microservices architecture allows developers to build and maintain applications with ease, and enterprises are rapidly adopting it to build software using Spring Boot as their default framework. With this book, you’ll learn how to efficiently build and deploy microservices using Spring Boot. This microservices book will take you through tried and tested approaches to building distributed systems and implementing microservices architecture in your organization. Starting with a set of simple cooperating microservices developed using Spring Boot, you’ll learn how you can add functionalities such as persistence, make your microservices reactive, and describe their APIs using Swagger/OpenAPI. As you advance, you’ll understand how to add different services from Spring Cloud to your microservice system. The book also demonstrates how to deploy your microservices using Kubernetes and manage them with Istio for improved security and traffic management. Finally, you’ll explore centralized log management using the EFK stack and monitor microservices using Prometheus and Grafana. By the end of this book, you’ll be able to build microservices that are scalable and robust using Spring Boot and Spring Cloud.

Who is this book for?

This book is for Java and Spring developers and architects who want to learn how to break up their existing monoliths into microservices and deploy them either on-premises or in the cloud using Kubernetes as a container orchestrator and Istio as a service Mesh. No familiarity with microservices architecture is required to get started with this book.

What you will learn

  • Build reactive microservices using Spring Boot
  • Develop resilient and scalable microservices using Spring Cloud
  • Use OAuth 2.0/OIDC and Spring Security to protect public APIs
  • Implement Docker to bridge the gap between development, testing, and production
  • Deploy and manage microservices using Kubernetes
  • Apply Istio for improved security, observability, and traffic management

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 20, 2019
Length: 668 pages
Edition : 1st
Language : English
ISBN-13 : 9781789613520
Vendor :
Oracle
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning

Product Details

Publication date : Sep 20, 2019
Length: 668 pages
Edition : 1st
Language : English
ISBN-13 : 9781789613520
Vendor :
Oracle
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 163.97
Mastering Microservices with Java
$48.99
Java Coding Problems
$54.99
Hands-On Microservices with Spring Boot and Spring Cloud
$59.99
Total $ 163.97 Stars icon

Table of Contents

24 Chapters
Section 1: Getting Started with Microservice Development Using Spring Boot Chevron down icon Chevron up icon
Introduction to Microservices Chevron down icon Chevron up icon
Introduction to Spring Boot Chevron down icon Chevron up icon
Creating a Set of Cooperating Microservices Chevron down icon Chevron up icon
Deploying Our Microservices Using Docker Chevron down icon Chevron up icon
Adding an API Description Using OpenAPI/Swagger Chevron down icon Chevron up icon
Adding Persistence Chevron down icon Chevron up icon
Developing Reactive Microservices Chevron down icon Chevron up icon
Section 2: Leveraging Spring Cloud to Manage Microservices Chevron down icon Chevron up icon
Introduction to Spring Cloud Chevron down icon Chevron up icon
Adding Service Discovery Using Netflix Eureka and Ribbon Chevron down icon Chevron up icon
Using Spring Cloud Gateway to Hide Microservices Behind an Edge Server Chevron down icon Chevron up icon
Securing Access to APIs Chevron down icon Chevron up icon
Centralized Configuration Chevron down icon Chevron up icon
Improving Resilience Using Resilience4j Chevron down icon Chevron up icon
Understanding Distributed Tracing Chevron down icon Chevron up icon
Section 3: Developing Lightweight Microservices Using Kubernetes Chevron down icon Chevron up icon
Introduction to Kubernetes Chevron down icon Chevron up icon
Deploying Our Microservices to Kubernetes Chevron down icon Chevron up icon
Implementing Kubernetes Features as an Alternative Chevron down icon Chevron up icon
Using a Service Mesh to Improve Observability and Management Chevron down icon Chevron up icon
Centralized Logging with the EFK Stack Chevron down icon Chevron up icon
Monitoring Microservices Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.9
(17 Ratings)
5 star 29.4%
4 star 11.8%
3 star 11.8%
2 star 11.8%
1 star 35.3%
Filter icon Filter
Top Reviews

Filter reviews by




Chris Jan 29, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a great book. It's the most thorough examination of this topic I have seen to date. The example code is worth its weight in gold, even if it has a few minor problems. Just knowing that it worked as written for the author provides the reader with a baseline from which to work that is very valuable as a reference design / starting point. If you intend to try to go through all the examples on Windows, you will run into many issues, and it will take you longer. The test-em-all.bash script works on Git Bash for the first 12 chapters or so. I had some good luck with the Windows Subsystem for Linux - Ubuntu in the later chapters, but I will probably switch to a cloud instance or use my MacBook for the last 4 chapters. Again, this is a great book, well worth the price.
Amazon Verified review Amazon
Roy Feb 28, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a a great book if you want to get the flow of micro service pattern using spring cloud. Excellent, the way author explained the concept. the source code works and the examples are real cases you would encounter if you are lucku to work on spring microservices project.if you get a build error on springfox-swagger dependencies, add the dependencies in product-composite-service. Not sure this was not documented on errata page implementation('org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE')
Amazon Verified review Amazon
magdi amer Oct 04, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Best book I have read about the topic. It goes from generic concepts to details, making the learning process easy
Amazon Verified review Amazon
A reader in Denver Oct 04, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've finished the first 6 chapters of this book and it's the best Spring book I've read. It uses Spring Boot 2.1 with JDK 12 so it may be the only up to date book on Spring Boot available right now. Most other Spring books are in need of an update for Spring Boot 2 and current versions of the JDK.The author smartly includes source code for each chapter which allows easily seeing the changes from one chapter to another as the book progresses. And his source code builds and runs correctly, which is not the case for some other Spring books. The author and technical reviewer did quality work.The book uses Docker containers right from the early chapters including docker-compose. The third section of the book covers Kubernetes, which I haven't gotten to yet. I'll post an update to this review if needed as I complete this book.This is not an introduction to Spring Boot so it probably shouldn't be your first book on Spring Boot. This is the book to get if you want to know the state of the art in Spring Boot microservices and how they are actually deployed and orchestrated.
Amazon Verified review Amazon
Stefan Klose Jan 20, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Sehr empfehlenswert. Aus meiner Sicht wird auf Praxisrelevante Themen didaktisch hervorragend eingegangen und die Beispiele sind qualitativ sehr hochwertig (ladet die aktuelleste Version bei GitHub runter). Ich habe die Kubernetesbeispiele so erweitert, dass sie auf der Google Kubernetes Engine laufen mit den jeweils akutellen Komponenten. Mit dem Einsatz von Skaffold und JIB eine gute Übung.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.