spring-framework / org.springframework.web.servlet.mvc.annotation / ResponseStatusExceptionResolver

ResponseStatusExceptionResolver

open class ResponseStatusExceptionResolver : AbstractHandlerExceptionResolver, MessageSourceAware

A org.springframework.web.servlet.HandlerExceptionResolver that uses the ResponseStatus annotation to map exceptions to HTTP status codes.

This exception resolver is enabled by default in the org.springframework.web.servlet.DispatcherServlet and the MVC Java config and the MVC namespace.

As of 4.2 this resolver also looks recursively for @ResponseStatus present on cause exceptions, and as of 4.2.2 this resolver supports attribute overrides for @ResponseStatus in custom composed annotations.

As of 5.0 this resolver also supports ResponseStatusException.

Author
Arjen Poutsma

Author
Rossen Stoyanchev

Author
Sam Brannen

Since
3.0

See Also
ResponseStatusResponseStatusException

Constructors

<init>

ResponseStatusExceptionResolver()

A org.springframework.web.servlet.HandlerExceptionResolver that uses the ResponseStatus annotation to map exceptions to HTTP status codes.

This exception resolver is enabled by default in the org.springframework.web.servlet.DispatcherServlet and the MVC Java config and the MVC namespace.

As of 4.2 this resolver also looks recursively for @ResponseStatus present on cause exceptions, and as of 4.2.2 this resolver supports attribute overrides for @ResponseStatus in custom composed annotations.

As of 5.0 this resolver also supports ResponseStatusException.

Functions

setMessageSource

open fun setMessageSource(messageSource: MessageSource): Unit