类 ExceptionHandlerMethodResolver
- java.lang.Object
- org.springframework.web.method.annotation.ExceptionHandlerMethodResolver
public class ExceptionHandlerMethodResolver extends Object
Discovers @ExceptionHandler methods in a given class, including all of its superclasses, and helps to resolve a givenExceptionto the exception types supported by a givenMethod.- 从以下版本开始:
- 3.1
- 作者:
- Rossen Stoyanchev, Juergen Hoeller
字段概要
字段 修饰符和类型 字段 说明 static ReflectionUtils.MethodFilterEXCEPTION_HANDLER_METHODSA filter for selecting@ExceptionHandlermethods.
构造器概要
构造器 构造器 说明 ExceptionHandlerMethodResolver(Class<?> handlerType)A constructor that findsExceptionHandlermethods in the given type.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanhasExceptionMappings()Whether the contained type has any exception mappings.MethodresolveMethod(Exception exception)Find aMethodto handle the given exception.MethodresolveMethodByExceptionType(Class<? extends Throwable> exceptionType)Find aMethodto handle the given exception type.MethodresolveMethodByThrowable(Throwable exception)Find aMethodto handle the given Throwable.
字段详细资料
EXCEPTION_HANDLER_METHODS
public static final ReflectionUtils.MethodFilter EXCEPTION_HANDLER_METHODS
A filter for selecting@ExceptionHandlermethods.
构造器详细资料
ExceptionHandlerMethodResolver
public ExceptionHandlerMethodResolver(Class<?> handlerType)
A constructor that findsExceptionHandlermethods in the given type.- 参数:
handlerType- the type to introspect
方法详细资料
hasExceptionMappings
public boolean hasExceptionMappings()
Whether the contained type has any exception mappings.
resolveMethod
@Nullable public Method resolveMethod(Exception exception)
Find aMethodto handle the given exception. UseExceptionDepthComparatorif more than one match is found.- 参数:
exception- the exception- 返回:
- a Method to handle the exception, or
nullif none found
resolveMethodByThrowable
@Nullable public Method resolveMethodByThrowable(Throwable exception)
Find aMethodto handle the given Throwable. UseExceptionDepthComparatorif more than one match is found.- 参数:
exception- the exception- 返回:
- a Method to handle the exception, or
nullif none found - 从以下版本开始:
- 5.0
resolveMethodByExceptionType
@Nullable public Method resolveMethodByExceptionType(Class<? extends Throwable> exceptionType)
Find aMethodto handle the given exception type. This can be useful if anExceptioninstance is not available (e.g. for tools).- 参数:
exceptionType- the exception type- 返回:
- a Method to handle the exception, or
nullif none found