org.springframework.web.method.annotation
Class ExceptionHandlerMethodResolver
java.lang.Object
org.springframework.web.method.annotation.ExceptionHandlerMethodResolver
public class ExceptionHandlerMethodResolver
- extends Object
Given a set of @ExceptionHandler
methods at initialization, finds
the best matching method mapped to an exception at runtime.
Exception mappings are extracted from the method @ExceptionHandler
annotation or by looking for Throwable
method arguments.
- Since:
- 3.1
- Author:
- Rossen Stoyanchev
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EXCEPTION_HANDLER_METHODS
public static final ReflectionUtils.MethodFilter EXCEPTION_HANDLER_METHODS
- A filter for selecting @
ExceptionHandler
methods.
ExceptionHandlerMethodResolver
public ExceptionHandlerMethodResolver(Class<?> handlerType)
- A constructor that finds
ExceptionHandler
methods in a handler.
- Parameters:
handlerType
- the handler to inspect for exception handler methods.
- Throws:
IllegalStateException
- If an exception type is mapped to two methods.
IllegalArgumentException
- If an @ExceptionHandler
method is not mapped to any exceptions.
resolveMethod
public Method resolveMethod(Exception exception)
- Find a method to handle the given exception. If more than one match is
found, the best match is selected via
ExceptionDepthComparator
.
- Parameters:
exception
- the exception
- Returns:
- an @
ExceptionHandler
method, or null