Class ResponseEntityExceptionHandler

java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
All Implemented Interfaces:
Aware, MessageSourceAware

public abstract class ResponseEntityExceptionHandler extends Object implements MessageSourceAware
A class with an @ExceptionHandler method that handles all Spring MVC raised exceptions by returning a ResponseEntity with RFC 7807 formatted error details in the body.

Convenient as a base class of an @ControllerAdvice for global exception handling in an application. Subclasses can override individual methods that handle a specific exception, override handleExceptionInternal(java.lang.Exception, java.lang.Object, org.springframework.http.HttpHeaders, org.springframework.http.HttpStatusCode, org.springframework.web.context.request.WebRequest) to override common handling of all exceptions, or override createResponseEntity(java.lang.Object, org.springframework.http.HttpHeaders, org.springframework.http.HttpStatusCode, org.springframework.web.context.request.WebRequest) to intercept the final step of creating the ResponseEntity from the selected HTTP status code, headers, and body.

Since:
3.2
Author:
Rossen Stoyanchev