Top Description Methods
org.springframework.web.bind.annotation

public @Interface ExceptionHandler

extends Annotation
Annotations
@Target:METHOD
@Retention:RUNTIME
@Documented
@Reflective:ExceptionHandlerReflectiveProcessor
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.springframework.aot.hint.annotation.Reflective

Annotation for handling exceptions in specific handler classes and/or handler methods.

Handler methods which are annotated with this annotation are allowed to have very flexible signatures. They may have parameters of the following types, in arbitrary order:

The following return types are supported for handler methods:

You may combine the ExceptionHandler annotation with @ResponseStatus for a specific HTTP error status.

Authors
Arjen Poutsma, Juergen Hoeller
Since
3.0
See Also
ControllerAdvice, org.springframework.web.context.request.WebRequest

Method Summary

Modifier and TypeMethod and Description
public Class<? extends Throwable>[]
value()

Exceptions handled by the annotated method.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public Class<? extends Throwable>[] value()

Exceptions handled by the annotated method. If empty, will default to any exceptions listed in the method argument list.