org.springframework.web.method.annotation

## Class ExceptionHandlerMethodResolver

- java.lang.Object
- - org.springframework.web.method.annotation.ExceptionHandlerMethodResolver

-     public class ExceptionHandlerMethodResolver
      extends Object

  Discovers @ExceptionHandler methods in a given class type, including all super types, and helps to resolve an Exception to the method its mapped to. Exception mappings are defined through `@ExceptionHandler` annotation or by looking at the signature of an `@ExceptionHandler` method.
  Since:
    3.1
  Author:
    Rossen Stoyanchev

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ReflectionUtils.MethodFilter` | `EXCEPTION_HANDLER_METHODS` A filter for selecting `@ExceptionHandler` methods.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExceptionHandlerMethodResolver(Class<?> handlerType)` A constructor that finds `ExceptionHandler` methods in the given type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `hasExceptionMappings()` Whether the contained type has any exception mappings.
    `Method` | `resolveMethod(Exception exception)` Find a method to handle the given exception.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EXCEPTION_HANDLER_METHODS

          public static final ReflectionUtils.MethodFilter EXCEPTION_HANDLER_METHODS

      A filter for selecting `@ExceptionHandler` methods.

  - ### Constructor Detail

    - #### ExceptionHandlerMethodResolver

          public ExceptionHandlerMethodResolver(Class<?> handlerType)

      A constructor that finds `ExceptionHandler` methods in the given type.
      Parameters:
        `handlerType` - the type to introspect

  - ### Method Detail

    - #### hasExceptionMappings

          public boolean hasExceptionMappings()

      Whether the contained type has any exception mappings.

    - #### resolveMethod

          public Method resolveMethod(Exception exception)

      Find a method to handle the given exception. Use `ExceptionDepthComparator` if more than one match is found.
      Parameters:
        `exception` - the exception
      Returns:
        a method to handle the exception or `null`