In general, there are following three layers in a Spring Boot application, or in any modern web application for that matter.
1. Controller
- It is responsible for the interaction with the clients and handles all the requests coming into the solution and responses going out of it.
2. Service
- This layer sits between the controller and repository layer and acts as a liaison / mediator between them and it is in this layer that all the core business logics are implemented.
- At some places, this layer is further broken down into two sub-layers:
a. Service (Interface layer)
b. Service Implementation (Implementing Class layer)
3. Repository
- It is the layer that is responsible for the interaction with the database system in the back-end. It sole purpose is to create/read/update/delete (CRUD) data to/from the database.
- It is also known as DAO (Data Access Object) in some solutions.
- Just like in service, at some places, this layer is further broken down into two sub-layers:
a. Repository (Interface layer)
b. Repository Implementation (Implementing Class layer)
No comments:
Post a Comment