Book Image

Mastering Spring 5.0

By : In28Minutes Official
Book Image

Mastering Spring 5.0

By: In28Minutes Official

Overview of this book

Spring 5.0 is due to arrive with a myriad of new and exciting features that will change the way we’ve used the framework so far. This book will show you this evolution—from solving the problems of testable applications to building distributed applications on the cloud. The book begins with an insight into the new features in Spring 5.0 and shows you how to build an application using Spring MVC. You will realize how application architectures have evolved from monoliths to those built around microservices. You will then get a thorough understanding of how to build and extend microservices using Spring Boot. You will also understand how to build and deploy Cloud-Native microservices with Spring Cloud. The advanced features of Spring Boot will be illustrated through powerful examples. We will be introduced to a JVM language that’s quickly gaining popularity - Kotlin. Also, we will discuss how to set up a Kotlin project in Eclipse. By the end of the book, you will be equipped with the knowledge and best practices required to develop microservices with the Spring Framework.
Table of Contents (20 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Preface

Spring 5.0 is due to arrive with a myriad of new and exciting features that will change the way we've used the framework so far. This book will show you this evolution--from solving the problems of testable applications to building distributed applications on the Cloud. The book begins with an insight into the new features in Spring 5.0, and shows you how to build an application using Spring MVC. You will then get a thorough understanding of how to build and extend microservices using the Spring Framework. You will also understand how to build and deploy Cloud applications. You will realize how application architectures have evolved from monoliths to those built around microservices. The advanced features of Spring Boot will also be covered and displayed through powerful examples. By the end of this book, you will be equipped with the knowledge and best practices to develop applications with the Spring Framework.

What this book covers

Chapter 1, Evolution to Spring Framework 5.0, takes you through the evolution of the Spring Framework, ranging from its initial versions to Spring 5.0. Initially, Spring was used to develop testable applications using dependency injection and core modules. Recent Spring Projects, such as Spring Boot, Spring Cloud, Spring Cloud Data Flow--deal with application infrastructure and moving applications to Cloud. We get an overview of different Spring modules and projects.

Chapter 2, Dependency Injection, dives deep into dependency injection. We will look at different kinds of dependency injection methods available in Spring, and how auto-wiring makes your life easy. We will also take a quick look into unit testing.

Chapter 3, Building a Web Application with Spring MVC, gives a quick overview of building a web application with Spring MVC.

Chapter 4, Evolution toward Microservices and Cloud-Native Applications, explains the evolution of application architectures in the last decade. We will understand why microservices and Cloud Native applications are needed and get a quick overview of the different Spring projects that help us build Cloud-Native applications.

Chapter 5, Building Microservices with Spring Boot, discusses how Spring Boot takes away the complexity in creating production-grade Spring-based applications. It makes it easy to get started with Spring-based projects and provides easy integration with third-party libraries. In this chapter, we will take the students on a journey with Spring Boot. We will start with implementing a basic web service and then move on to adding caching, exception handling, HATEOAS, and internationalization, while making use of different features from the Spring Framework.

Chapter 6, Extending Microservices, focuses on adding more advanced features to the microservices that we built in Chapter 4, Evolution toward Microservices and Cloud-Native Applications.

Chapter 7, Advanced Spring Boot Features, takes a look at the advanced features in Spring Boot. You will learn how to monitor a microservice with a Spring Boot Actuator. Then, you will deploy the microservice to Cloud. You will also learn how to develop more effectively with the developer tools provided by Spring Boot.

Chapter 8, Spring Data, discusses the Spring Data module. We will develop simple applications to integrate Spring with JPA and Big Data technologies.

Chapter 9, Spring Cloud, discusses the distributed systems in the Cloud that have common problems, configuration management, service discovery, circuit breakers, and intelligent routing. In this chapter, you will learn how Spring Cloud helps you develop solutions for these common patterns. These solutions should work well on the Cloud as well as developer local systems.

Chapter 10, Spring Cloud Data Flow, talks about the Spring Cloud Data Flow, which offers a collection of patterns and best practices for microservices-based distributed streaming and batch data pipelines. In this chapter, we will understand the basics of Spring Cloud Data Flow and use it to build basic data flow use cases.

Chapter 11, Reactive Programming, explores programming with asynchronous data streams. In this chapter, we will understand Reactive programming and take a quick look at the features provided by the Spring Framework.

Chapter 12, Spring Best Practices, helps you understand best practices in developing enterprise applications with Spring related to unit testing, integration testing, maintaining Spring configuration, and more.

Chapter 13,Working with Kotlin in Spring, introduces you to a JVM language gaining quick popularity--Kotlin. We will discuss how to setup a Kotlin project in Eclipse. We will create a new Spring Boot project using Kotlin and implement a couple of basic services with unit and integration testing.

What you need for this book

To be able to run examples from this book, you will need the following tools:

  • Java 8
  • Eclipse IDE
  • Postman

We will use Maven embedded into Eclipse IDE to download all the dependencies that are needed.

Who this book is for

This book is for experienced Java developers who knows the basics of Spring, and wants to learn how to use Spring Boot to build applications and deploy them to the Cloud.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, and user input are shown as follows: "Configure spring-boot-starter-parent in your pom.xml file".

A block of code is set as follows:

<properties>
  <mockito.version>1.10.20</mockito.version>
</properties>

Any command-line input or output is written as follows:

mvn clean install

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Provide the details and click on Generate Project."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

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/Mastering-Spring-5.0. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code--we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.