In the previous article, we have seen the Introduction of Spring Framework. In this article, we will understand the architecture and workflow of Spring Boot.
Spring Boot is the submodule of the Spring Framework which is used to produce a production-ready application with no XML configuration and annotation-based configuration. So, let us understand the Architecture of Spring Boot.
Spring Boot Architecture
The Spring Boot Architecture consists of a layered architecture where each layer only depends on the adjoining layer. As it is a layered architecture, each layer communicates with the layer directly below or above it.
Following are the layers of Spring Boot Architecture:
- Presentation Layer/Display Layer.
- Business Layer.
- Persistence Layer.
- Database Layer.
- Presentation Layer: It is a front-end part of the application. It is also called a display layer. It handles all the incoming HTTP requests, interprets the JSON Object, handles authentication and etc. After completing authentication, it moves to the next layer i.e Business Layer.
- Business Layer: The business layer is responsible for handling business logic. It also performs authorization and validation.
- Persistence Layer: The persistence layer is responsible for handling storage logic. It translates business objects from and to database rows.
- Database Layer: It consists of databases.
Now, let us understand the workflow of Spring Boot Architecture.
Spring Boot Flow Architecture
Spring Boot is built on the top of Spring Framework. So, it has all the features and modules of Spring-like- Spring MVC, Spring core and etc except one thing, now there is no need for DAO and DAOImpl classes in Spring Boot. The diagram below shows the workflow of Spring Boot.
It consists of Client, Controller, Service Layer, Model, and Database.
- First, create a data access layer and perform CRUD Operations.
- Then, the client makes the HTTP request.
- Now, the request goes to the controller, the controller will map the request and handles it.
- If any logic needs to be performed, it will call the Service layer.
- The service layer has all the business logic. It is mapped with JPA to model class.
- Now, in the end, the JSP page is returned.
Thus, this was all about Spring Boot Architecture and Spring Boot Workflow. In the next article, we will do the environment setup for the Spring Boot.