service layer

The layer of an application that holds use cases and business rules, sitting between controllers and repositories.

In more detail

Services know nothing about HTTP or JSON, which lets unit tests call them directly with fake repositories. They translate entities into response models and decide transaction boundaries.

Example

class OrderService { OrderView find(String id) { ... } }

Related terms

Taught in

References