Preface
Getting Started with Spring Microservices begins with an overview of the Spring Framework 5.0, its design patterns, and its guidelines that enable you to implement responsive microservices at scale. You will learn how to use GoF patterns in application design. You will understand the dependency injection pattern, which is the main principle behind the decoupling process of the Spring Framework and makes it easier to manage your code. Then, you will learn how to use proxy patterns in aspect-oriented programming and remoting. Moving on, you will understand the JDBC template patterns and their use in abstracting database access.
After understanding the basics, you will move on to more advanced topics, such as reactive streams and concurrency. Written to the latest specifications of Spring that focuses on Reactive Programming, the Learning Path teaches you how to build modern, internet-scale Java applications in no time.
Next, you will understand how Spring Boot is used to deploying serverless autonomous services by removing the need to have a heavyweight application server. You’ll also explore ways to deploy your microservices to Docker and managing them with Mesos.
By the end of this Learning Path, you will have the clarity and confidence for implementing microservices using Spring Framework.
This Learning Path includes content from the following Packt products:
• Spring 5 Microservices by Rajesh R V • Spring 5 Design Patterns by Dinesh Rajput
Who this book is for
Getting Started with Spring Microservices is ideal for Spring developers who want to use design patterns to solve common design problems and build cloud-ready, Internet-scale applications, and simple RESTful services.
What this book covers
Chapter 1, Getting Started with the Spring Framework 5.0 and Design Patterns, gives an overview of the Spring 5 Framework and all new features of the Spring 5 Framework, including some basic examples of DI and AOP. You’ll also get an overview of the great Spring portfolio.
Chapter 2, Overview of GOF Design Patterns - Core Design Patterns, gives an overview of the Core Design Pattern of the GoF Design Patterns family, including some best practices for an application design. You'll also get an overview of the common problems solving with design patterns.
Chapter 3, Wiring Beans using Dependency Injection Pattern, explores dependency injection pattern and detail about the configuration of Spring in an application, showing you various ways of configurations in your application. This includes a configuration with XML, Annotation, Java, and Mix.
Chapter 4, Spring Aspect Oriented Programming with Proxy and Decorator Pattern, explores how to use Spring AOP to decouple cross-cutting concerns from the objects that they service. This chapter also sets the stage for later chapters where you'll use AOP to provide declarative services such as transactions, security, and caching.
Chapter 5, Accessing Database with Spring and JDBC Template Patterns, explores how to access the data with Spring and JDBC; here, you’ll see how to use Spring's JDBC abstraction and JDBC Template to query relational databases in a way that is far simpler than native JDBC.
Chapter 6, Improving Application Performance Using Caching Patterns, shows how to improve application performance by avoiding the database altogether if the data needed is readily available. So, I will show you how Spring provides support for caching data.
Chapter 7, Implementing Reactive Design Patterns, explores the Reactive Programming Model, which is programming with asynchronous data streams. You'll see how the Reactive System is implemented in the Spring Web Module.
Chapter 8, Implementing Concurrency Patterns, takes a closer look at concurrency when handling multiple connections inside a web server. As outlined in our architectural model, request handling is decoupled from application logic.
Chapter 9, Demystifying Microservices, gives you an introduction to microservices. This chapter covers the background, evaluation, and fundamental concepts of microservices.
Chapter 10, Related Architecture Styles and Use Cases, covers the relationship with Service-Oriented Architecture, the concepts of cloud native and Twelve Factor applications, and explains some of the common use cases.
Chapter 11, Building Microservices with Spring Boot, introduces building REST and message-based microservices using the Spring Framework and how to wrap them with Spring Boot. In addition, we will also explore some core capabilities of Spring Boot.
Chapter 12, Scale Microservices with Spring Cloud Components, shows you how to scale previous examples using Spring Cloud stack capabilities. It details the architecture and different components of Spring Cloud and how they integrate together.
Chapter 13, Logging and Monitoring Microservices, covers the importance of logging and monitoring aspects when developing microservices. Here, we look at the details of some of the best practices when using microservices, such as centralized logging and monitoring capabilities using open source tools and how to integrate them with Spring projects.
Chapter 14, Containerizing Microservices with Docker, explains containerization concepts in the context of microservices. Using Mesos and Marathon, it demonstrates next-level implementation to replace the custom life cycle manager for large deployments.
Chapter 15, Scaling Dockerized Microservices with Mesos and Marathon, explains auto-provisioning and deployment of microservices. Here, we will also learn how to use Docker containers in the preceding example for large-scale deployments.
To get the most out of this book
This book can be read without a computer or laptop at hand, in which case you need nothing more than the book itself. Although to follow the examples in the book, you need Java 8, which you can download from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html. You will also need your favorite IDE for the examples, but I have used the Software Spring Tool Suite; download the latest version of Spring Tool Suite (STS) from https://spring.io/tools/sts/allaccording to your system OS. The Java 8 and STS work on a variety of platforms--Windows, macOS, and Linux.
Other software components required are as follows:
- Spring Cloud Dalston RELEASE
- elasticsearch-1.5.2
- kibana-4.0.2-darwin-x64
- logstash-2.1.2
- Docker version (17.03.1-ce)
- Docker Hub
- Mesos version 1.2.0
- Docker version 17.03.1-ce
- Marathon version 3.4.9
Download the example code files
You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packt.com.
- Select the
SUPPORT
tab. - Click on
Code Downloads & Errata
. - Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Building-Microservices-with-Spring. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Conventions used
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "The EventEmitter
object is defined in the events module of Node.js."
A block of code is set as follows:
if (anotherNote instanceof Note) { ... it's a Note, so act on it as a Note }
Any command-line input or output is written as follows:
$ npm update express
$ npm update
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "If you need something different, click on the DOWNLOADS link in the header for all possible downloads:"
Note
Warnings or important notes appear like this.
Note
Tips and tricks appear like this.
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected]
.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected]
with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.