"... The service checks if the current user has permission to call the function and initializes a database transaction (if needed)..."
"...In this architecture we have three interfaces, each requiring a different kind of validation:
The controller defines the first interface. In order to deserialize the request, the request needs to be validated against our API schema. This is done implicitly by a mapping framework like Jackson and explicitly by constraints like @NotNull. We call this request validation.
The service may check the privileges of the current user and ensure preconditions that will make calling the domain layer possible. Let us call this service validation.
While the previous validations ensure some basic preconditions, the domain layer alone is responsible for keeping a valid state. This domain validation is the most crucial one..."
"... The service checks if the current user has permission to call the function and initializes a database transaction (if needed)..."
"...In this architecture we have three interfaces, each requiring a different kind of validation: The controller defines the first interface. In order to deserialize the request, the request needs to be validated against our API schema. This is done implicitly by a mapping framework like Jackson and explicitly by constraints like @NotNull. We call this request validation. The service may check the privileges of the current user and ensure preconditions that will make calling the domain layer possible. Let us call this service validation. While the previous validations ensure some basic preconditions, the domain layer alone is responsible for keeping a valid state. This domain validation is the most crucial one..."
https://medium.com/sprang/validation-and-exception-handling-with-spring-ba44b3ee0723