Introduction to Spring Boot
In this chapter, we will be introduced to how to build a set of cooperating microservices using Spring Boot, focusing on how to develop functionality that delivers business value. The challenges with microservices that we pointed out in the previous chapter will be considered only to some degree, but they will be addressed to their full extent in later chapters.
We will develop microservices that contain business logic based on plain Spring Beans and expose REST APIs using Spring WebFlux. The APIs will be documented based on the OpenAPI Specification using springdoc-openapi
. To make the data processed by the microservices persistent, we will use Spring Data to store data in both SQL and NoSQL databases.
Since Spring Boot v2.0 was released in March 2018, it has become much easier to develop reactive microservices, including non-blocking synchronous REST APIs. To develop message-based asynchronous services, we will use Spring Cloud Stream. Refer to Chapter 1, Introduction to Microservices, the Reactive microservices section, for more information.
In November 2022, Spring Boot 3.0 was released. It is based on Spring Framework 6.0 and Jakarta EE 9, also being compatible with Jakarta EE 10. Java 17, the current long-term support (LTS) release, is required as the minimum Java version.
Finally, we will use Docker to run our microservices as containers. This will allow us to start and stop our microservice landscape, including database servers and a message broker, with a single command.
That’s a lot of technologies and frameworks, so let’s go through each of them briefly to see what they are about!
In this chapter, we will introduce the following open source projects:
- Spring Boot
(This section also includes an overview of what’s new in v3.0 and on how to migrate v2 applications.)
- Spring WebFlux
springdoc-openapi
- Spring Data
- Spring Cloud Stream
- Docker
More details about each product will be provided in upcoming chapters.