Spring Boot – Architecture
The Spring Boot is built on top of the core Spring framework. It is a simplified and automated version of the spring framework. The spring boot follows a layered architecture in which each layer communicates to other layers(Above or below in hierarchical order). The spring boot documentation provides the following definition to the Spring Boot Framework.
Spring Boot makes it easy to create stand-alone, production-grade Spring based application that you can “Just Run”
The main aim of spring boot is to remove the XML and annotations-based configuration settings from the application. Along with this spring boot provides the following benefits such as opinionated(options to later change the configuration), convention over configuration, stand-alone, and production-ready.
Spring Boot Layers
The spring boot consists of the following four layers:
- Presentation Layer – Authentication & Json Translation
- Business Layer – Business Logic, Validation & Authorization
- Persistence Layer – Storage Logic
- Database Layer – Actual Database
Fig 1 – Layers Of Spring Boot
1. Presentation Layer
The presentation layer is the top layer of the spring boot architecture. It consists of Views. i.e., the front-end part of the application. It handles the HTTP requests and performs authentication. It is responsible for converting the JSON field’s parameter to Java Objects and vice-versa. Once it performs the authentication of the request it passes it to the next layer. i.e., the business layer.
2. Business Layer
The business layer contains all the business logic. It consists of services classes. It is responsible for validation and authorization.
3. Persistence Layer
The persistence layer contains all the database storage logic. It is responsible for converting business objects to the database row and vice-versa.
4. Database Layer
The database layer contains all the databases such as MySql, MongoDB, etc. This layer can contain multiple databases. It is responsible for performing the CRUD operations.
Spring Boot Flow Architecture
Fig 2 – Spring boot flow architecture
Explanation:
- The Client makes an HTTP request(GET, PUT, POST, etc.)
- The HTTP request is forwarded to the Controller. The controller maps the request. It processes the handles and calls the server logic.
- The business logic is performed in the Service layer. The spring boot performs all the logic over the data of the database which is mapped to the spring boot model class through Java Persistence Library(JPA).
- The JSP page is returned as Response from the controller.
Contact Us