Spring Microservices
eBook - ePub

Spring Microservices

  1. 436 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Spring Microservices

About this book

Build scalable microservices with Spring, Docker, and Mesos

About This Book

  • Learn how to efficiently build and implement microservices in Spring, and how to use Docker and Mesos to push the boundaries of what you thought possible
  • Examine a number of real-world use cases and hands-on code examples.
  • Distribute your microservices in a completely new way

Who This Book Is For

If you are a Spring developers and want to build cloud-ready, internet-scale applications to meet modern business demands, then this book is for you Developers will understand how to build simple Restful services and organically grow them to truly enterprise grade microservices ecosystems.

What You Will Learn

  • Get to know the microservices development lifecycle process
  • See how to implement microservices governance
  • Familiarize yourself with the microservices architecture and its benefits
  • Use Spring Boot to develop microservices
  • Find out how to avoid common pitfalls when developing microservices
  • Be introduced to end-to-end microservices written in Spring Framework and Spring Boot

In Detail

The Spring Framework is an application framework and inversion of the control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions to build web applications on top of the Java EE platform. This book will help you implement the microservice architecture in Spring Framework, Spring Boot, and Spring Cloud. Written to the latest specifications of Spring, you'll be able to build modern, Internet-scale Java applications in no time.

We would start off with the guidelines to implement responsive microservices at scale. We will then deep dive into Spring Boot, Spring Cloud, Docker, Mesos, and Marathon. Next you will understand how Spring Boot is used to deploy autonomous services, server-less by removing the need to have a heavy-weight application server. Later you will learn how to go further by deploying your microservices to Docker and manage it with Mesos. By the end of the book, you'll will gain more clarity on how to implement microservices using Spring Framework and use them in Internet-scale deployments through real-world examples.

Style and approach

The book follows a step by step approach on how to develop microservices using Spring Framework, Spring Boot, and a set of Spring Cloud components that will help you scale your applications.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Spring Microservices


Table of Contents

Spring Microservices
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Demystifying Microservices
The evolution of microservices
Business demand as a catalyst for microservices evolution
Technology as a catalyst for the microservices evolution
Imperative architecture evolution
What are microservices?
Microservices – the honeycomb analogy
Principles of microservices
Single responsibility per service
Microservices are autonomous
Characteristics of microservices
Services are first-class citizens
Characteristics of services in a microservice
Microservices are lightweight
Microservices with polyglot architecture
Automation in a microservices environment
Microservices with a supporting ecosystem
Microservices are distributed and dynamic
Antifragility, fail fast, and self-healing
Microservices examples
An example of a holiday portal
A microservice-based order management system
An example of a travel agent portal
Microservices benefits
Supports polyglot architecture
Enabling experimentation and innovation
Elastically and selectively scalable
Allowing substitution
Enabling to build organic systems
Helping reducing technology debt
Allowing the coexistence of different versions
Supporting the building of self-organizing systems
Supporting event-driven architecture
Enabling DevOps
Relationship with other architecture styles
Relations with SOA
Service-oriented integration
Legacy modernization
Service-oriented application
Monolithic migration using SOA
Relations with Twelve-Factor apps
A single code base
Bundling dependencies
Externalizing configurations
Backing services are addressable
Isolation between build, release, and run
Stateless, shared nothing processes
Exposing services through port bindings
Concurrency to scale out
Disposability with minimal overhead
Development and production parity
Externalizing logs
Package admin processes
Microservice use cases
Microservices early adopters
The common theme is monolithic migrations
Summary
2. Building Microservices with Spring Boot
Setting up a development environment
Developing a RESTful service – the legacy approach
Moving from traditional web applications to microservices
Using Spring Boot to build RESTful microservices
Getting started with Spring Boot
Developing the Spring Boot microservice using the CLI
Developing the Spring Boot Java microservice using STS
Examining the POM file
Examining Application.java
Examining application.properties
Examining ApplicationTests.java
Testing the Spring Boot microservice
Developing the Spring Boot microservice using Spring Initializr – the HATEOAS example
What's next?
The Spring Boot configuration
Understanding the Spring Boot autoconfiguration
Overriding default configuration values
Changing the location of the configuration file
Reading custom properties
Using a .yaml file for configuration
Using multiple configuration profiles
Other options to read properties
Changing the default embedded web server
Implementing Spring Boot security
Securing microservices with basic security
Securing a microservice with OAuth2
Enabling cross-origin access for microservices
Implementing Spring Boot messaging
Developing a comprehensive microservice example
Spring Boot actuators
Monitoring using JConsole
Monitoring using SSH
Configuring application information
Adding a custom health module
Building custom metrics
Documenting microservices
Summary
3. Applying Microservices Concepts
Patterns and common design decisions
Establishing appropriate microservice boundaries
Autonomous functions
Size of a deployable unit
Most appropriate function or subdomain
Polyglot architecture
Selective scaling
Small, agile teams
Single responsibility
Replicability or changeability
Coupling and cohesion
Think microservice as a product
Designing communication styles
Synchronous style communication
Asynchronous style communication
How to decide which style to choose?
Orchestration of microservices
How many endpoints in a microservice?
One microservice per VM or multiple?
Rules engine – shared or embedded?
Role of BPM and workflows
Can microservices share data stores?
Setting up transaction boundaries
Altering use cases to simplify transactional requirements
Distributed transaction scenarios
Service endpoint design consideration
Contract design
Protocol selection
Message-oriented services
HTTP and REST endpoints
Optimized communication protocols
API documentations
Handling shared libraries
User interfaces in microservices
Use of API gateways in microservices
Use of ESB and iPaaS with microservices
Service versioning considerations
Design for cross origin
Handling shared reference data
Microservices and bulk operations
Microservices challenges
Data islands
Logging and monitoring
Dependency management
Organization culture
Governance challenges
Operation overheads
Testing microservices
Infrastructure provisioning
The microservices capability model
Core capabilities
Infrastructure capabilities
Supporting capabilities
Process and governance capabilities
Summary
4. Microservices Evolution – A Case Study
Reviewing the microservices capability model
Understanding the PSS application
Business process view
Functional view
Architectural view
Design view
Implementation view
Deployment view
Death of the monolith
Pain points
Stop gap fix
Retrospection
Shared data
Single database
Native queries
Stored procedures
Domain boundaries
Microservices to the rescue
The business case
Plan the evolution
Evolutionary approach
Identification of microservices boundaries
Analyze dependencies
Events as opposed to query
Events as opposed to synchronous updates
Challenge requirements
Challenge service boundaries
Final dependency graph
Prioritizing microservices for migration
Data synchronization during migration
Managing reference data
User interfaces and web applications
Session handling and security
Test strategy
Building ecosystem capabilities
Migrate modules only if required
Target architecture
Internal layering of microservices
Orchestrating microservices
Integration with other systems
Managing shared libraries
Handling exceptions
Target implementation view
Implementation projects
Running and testing the project
Summary
5. Scaling Microservices with Spring Cloud
Reviewing microservices capabilities
Reviewing BrownField's PSS implementation
What is Spring Cloud?
Spring Cloud releases
Components of Spring Cloud
Spring Cloud and Netflix OSS
Setting up the envi...

Table of contents

  1. Spring Microservices

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Spring Microservices by Rajesh RV in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Java. We have over one million books available in our catalogue for you to explore.