What are you doing the service layer in a Spring application?

I know that Spring application is divided into different layers: Config( where are our configs), DAO (for database), Model(our data Pojo classes), and Controllers( controllers) and service, which must contain business logic. In one project I saw this picture: In DAO class UserDAO which works with the database and Service have the UserService class which has a field UserDAO and he exactly copies all methods and inside UserDAO UserDAO just prescribes.getUsers(); Then data goes to the controller. Why you need a service in such applications if he just calls methods from DAO?
March 20th 20 at 11:42
1 answer
March 20th 20 at 11:44
Solution
There are two main reasons for the appearance of "transparent service layer" in applications:
  1. Because so decided. The author makes a primitive application that does not need layered architecture, but clever uncle say that the layers should be, and he coracial layers of ritual.
  2. For growth. The MVP service layer to put nothing but a well-developed business logic is expected in the next version. Much easier to make a blank layer, and then gradually to fill it than to add it then into working code.

Find more questions by tags JavaSpring