Preface
With growing demands, organizations are looking for systems that are robust and scalable. Hence the Spring Framework has become the most popular framework for Java development. It not only simplifies software development but also improves developer productivity. This book covers effective ways to develop robust applications in Java using Spring.
Who this book is for
Developers who are starting out with Spring will learn about the new Spring 5.0 framework concepts followed by their implementation in Java and Kotlin. The book will also help experienced Spring developers gain insights into the new features added in Spring 5.0.
What this book covers
Chapter 1, Journey to the Spring World, will guide you through the main concepts of Spring Framework. Here we learn to setup the environment by installing OpenJDK, Maven, IntelliJ IDEA, and Docker. By the end, we will create our first Spring application.
Chapter 2, Starting in the Spring World – the CMS Application, will begin by getting our hands dirty with Spring Initializr to create configurations for our CMS application. We will then learn how to create REST resources, add the service layer and finally integrate with AngularJS.
Chapter 3, Persistence with Spring Data and Reactive Fashion, will build upon our CMS application created in the previous chapter. Here we will learn how to persist data on a real database by learning about Spring Data Reactive MongoDB and PostgresSQL. We will finally learn about Project Reactor which will help you to create a non-blocking application in the JVM ecosystem.
Chapter 4, Kotlin Basics and Spring Data Redis, will give you a basic introduction to Kotlin while presenting the benefits of the language. We will then learn how to use Redis which will be used as a message broker using the publish-subscribe feature.
Chapter 5, Reactive Web Clients, will teach you how to use the Spring Reactive Web Client and make HTTP calls in a reactive fashion. We will also be introduced to RabbitMQ and Spring Actuator.
Chapter 6, Playing with Server-Sent Events, will help you develop an application which will filter tweets by text content. We will accomplish this by consuming the tweeter steam using Server-Sent Events which is a standard way to send data streams from a server to clients
Chapter 7, Airline Ticket System, will teach you to use Spring Messaging, WebFlux, and Spring Data components to build a airline ticket system. You will also learn about circuit breakers and OAuth in this chapter. By the end, we will create a system with many microservices to ensure scalability.
Chapter 8, Circuit Breakers and Security, will help you discover how to apply service discovery features for our business microservices while also understanding how the Circuit Breaker pattern can help us to bring resilience to our applications.
Chapter 9, Putting It All Together, will bring the entire book into perspective while also teaching you about the Turbine server. We will also look into the Hystrix Dashboard to monitor our different microservices to ensure maintainability and optimum performance of our applications.
To get the most out of this book
The readers are expected to have a basic knowledge of Java. Notion about Distributed Systems is an added advantage.
To execute code files in this book, you would need to have the following software/dependencies:
- IntelliJ IDEA Community Edition
- Docker CE
- pgAdmin
- Docker Compose
You will be assisted with installation processes,etc through this book.
Download the example code files
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.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.packtpub.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/Spring-5.0-By-Example. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/Spring50ByExample_ColorImages.pdf.
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: "It includes the infrastructure connections which are configured in the default profile in application.yaml
."
A block of code is set as follows:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency>
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
management:
endpoints:
web:
expose: "*"
Any command-line input or output is written as follows:
docker-compose up -d
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: "The next screen will be shown and we can configure the Environment Variable:
"
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: Email [email protected]
and mention the book title in the subject of your message. If you have questions about any aspect of this book, please 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.packtpub.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 packtpub.com.