Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

Overview of this book

Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 layer. However, where can we put the code for business operations?

The service layer exposes business operations that could be composed of multiple CRUD operations. These CRUD operations are usually performed by the repository objects. For...