The service layer

So far so good; we created a presentation layer that contains a controller, dispatcher servlet, view resolvers, and so on. Then, we created a domain layer that contains a single domain class, Product. Finally, we created the persistence layer, which contains a repository interface and an implementation to access our Product domain objects.

However, we are still missing one more concept called the service layer. Why do we need the service layer? We saw how a persistence layer deals with all of the logic related to data access (CRUD) and the presentation layer deals with all of the activities related to the web request and view; the domain layer contains classes to hold information that is retrieved from database records / the persistence ...

Get Spring MVC Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.