The role of the Controller layer, Service layer, Dao layer, entity layer, Configuration layer, and Utils layer in the SpringBoot project

1. Controller layer

  • The Controller layer is the control layer, which is generally identified by @RestController or @Controller annotations.
  • In Spring Boot, the control layer is responsible for receiving the request and forwarding the request to the corresponding service layer for processing, and returning the processing result to the client.

2. Service layer

  • The Service layer is a service layer, which is generally identified by @Service annotation.
  • In Spring Boot, the service layer is responsible for implementing business logic. They are equivalent to a combination of a series of operations, common operations include query, modification, deletion, etc.

3. Dao layer (Mapper layer)

  • The Dao layer is the data access layer, and the data access layer usually uses ORM frameworks such as JPA or MyBatis to simplify database operations.
  • In Spring Boot, the data access layer is the layer that interacts with the database, and is responsible for operations such as adding, deleting, modifying, and checking the database.

4. entity layer (model layer)

  • The entity layer is the entity layer, and the entity layer is generally identified by @Entity annotation.
  • In Spring Boot, the entity layer is responsible for representing the concrete data model. These models map to table structures in the database. They contain all methods for manipulating objects of this entity class, such as query, add, delete, etc.

5. Configuration layer

  • The Configuration layer is the configuration layer, and the configuration layer is generally identified by the @Configuration annotation.
  • In Spring Boot, the configuration layer is the configuration center of the entire system, responsible for defining and managing the configuration information of Spring Boot applications.

6. Utils layer

  • The Utils layer is a tool class layer, which can be customized and injected into the system using the @Component annotation.
  • In Spring Boot, the tool class layer is responsible for encapsulating some commonly used tool methods, such as date formatting, encryption and decryption, etc.

Functional structure diagram of each layer

insert image description here

Guess you like

Origin blog.csdn.net/weixin_61370021/article/details/130796200