Exception Handling¶
Controller Advice¶
The @ControllerAdvice
is an annotation, to handle the exceptions globally.
Exception Handler¶
The @ExceptionHandler
is an annotation used to handle the specific exceptions and sending the custom responses to the client.
Update URL: http://localhost:8071/products/9
Interceptor¶
- preHandle() method − This is used to perform operations before sending the request to the controller. This method should return true to return the response to the client.
- postHandle() method − This is used to perform operations before sending the response to the client.
- afterCompletion() method − This is used to perform operations after completing the request and response.