@ExceptionHandler method that handles all Spring
WebFlux 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 to override common handling of all exceptions,
or override createResponseEntity to intercept the final step of creating
the ResponseEntity from the selected HTTP status code, headers, and body.
| Modifier and Type | Field and Description |
|---|---|
| protected final Log | logger
Common logger for use in subclasses. |
| private MessageSource |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected ProblemDetail | Returns: the createdProblemDetail instancethe exception being handled ex, HttpStatusCode the status to associate with the exception status, String default value for the "detail" field defaultDetail, String the code to use to look up the "detail" field
through a detailMessageCode, Object[] MessageSource; if null then
ErrorResponse#getDefaultDetailMessageCode(Class, String) is used
to determine the default message code to usethe arguments to go with the detailMessageCode detailMessageArguments, ServerWebExchange exchange)Convenience method to create a |
| protected Mono | Returns: aMono with the created ResponseEntitythe body to use for the response body, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Create the |
| private static Locale | |
| protected MessageSource | |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of any |
| public final Mono | handleException(Exception
the exception to handle ex, ServerWebExchange the current request-response exchange)Handle all exceptions raised within Spring MVC handling of the request. |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, Object the body to use for the response body, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Internal handler method that all others in this class delegate to, for
common handling, and for the creation of a |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpStatus the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of any |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| protected Mono | Returns: aMono with the ResponseEntity for the responsethe exception to handle ex, HttpHeaders the headers to use for the response headers, HttpStatusCode the status code to use for the response status, ServerWebExchange the current request and response exchange)Customize the handling of |
| public void | setMessageSource(MessageSource
message source to be used by this object messageSource)Implements org. Set the Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. |
| logger | back to summary |
|---|---|
| protected final Log logger Common logger for use in subclasses. | |
| messageSource | back to summary |
|---|---|
| private MessageSource messageSource
| |
| ResponseEntityExceptionHandler | back to summary |
|---|---|
| public ResponseEntityExceptionHandler() | |
| createProblemDetail | back to summary |
|---|---|
| protected ProblemDetail createProblemDetail(Exception ex, HttpStatusCode status, String defaultDetail, String detailMessageCode, Object[] detailMessageArguments, ServerWebExchange exchange) Convenience method to create a
| |
| createResponseEntity | back to summary |
|---|---|
| protected Mono Create the
| |
| getLocale | back to summary |
|---|---|
| private static Locale getLocale(ServerWebExchange exchange) | |
| getMessageSource | back to summary |
|---|---|
| protected MessageSource getMessageSource() Get the
| |
| handleErrorResponseException | back to summary |
|---|---|
| protected Mono Customize the handling of any This method delegates to
| |
| handleException | back to summary |
|---|---|
| public final Mono Handle all exceptions raised within Spring MVC handling of the request.
| |
| handleExceptionInternal | back to summary |
|---|---|
| protected Mono Internal handler method that all others in this class delegate to, for
common handling, and for the creation of a The default implementation does the following:
| |
| handleHandlerMethodValidationException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleMethodNotAllowedException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleMethodValidationException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleMissingRequestValueException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleNotAcceptableStatusException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleResponseStatusException | back to summary |
|---|---|
| protected Mono Customize the handling of any This method delegates to
| |
| handleServerErrorException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleServerWebInputException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleUnsatisfiedRequestParameterException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleUnsupportedMediaTypeStatusException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| handleWebExchangeBindException | back to summary |
|---|---|
| protected Mono Customize the handling of This method delegates to
| |
| setMessageSource | back to summary |
|---|---|
| public void setMessageSource(MessageSource messageSource) Implements org. Doc from org. Set the Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.
| |