Spring Web Hierarchy

Hello, in this post, we will dive into the structures of the Spring web.

The hierarchy

There are Five layers

  • Web Layer
  • Service Layer
  • Repository layer
  • DTOs
  • Domain Model

Web layer

The web layer includes controllers, exception handles and view templates. Simply put, they are responsible for external requests and responses.

Service Layer

The service layer lies between the controller and Dao. Many believe that the service layer implements the core business logic. However, the service is only responsible for transactions and the order of the domains.

Repository Layer

This layer has access to the database. The repository layer includes repository interfaces and their implementations.

Dtos

DTO stands for data transfer object. They transfer objects between layers through returned values.

Domain Model

The domain model is any object that could think that can be understood and shared within the application. If you are making a computer application, a keyboard, monitor, and mouse could be the domain model. All the classes with entities are considered in the domain model.

Conclusion

I briefly went through the hierarchy of five layers in the spring web.