Class ExceptionHandlerMethodResolver
java.lang.Object
org.springframework.web.method.annotation.ExceptionHandlerMethodResolver
Discovers @ExceptionHandler methods in a given class,
 including all of its superclasses, and helps to resolve a given 
Exception
 to the exception types supported by a given Method.- Since:
- 3.1
- Author:
- Rossen Stoyanchev, Juergen Hoeller, Sam Brannen
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final ReflectionUtils.MethodFilterA filter for selecting@ExceptionHandlermethods.
- 
Constructor SummaryConstructorsConstructorDescriptionExceptionHandlerMethodResolver(Class<?> handlerType) A constructor that findsExceptionHandlermethods in the given type.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanWhether the contained type has any exception mappings.resolveMethod(Exception exception) Find aMethodto handle the given exception.resolveMethodByExceptionType(Class<? extends Throwable> exceptionType) Find aMethodto handle the given exception type.resolveMethodByThrowable(Throwable exception) Find aMethodto handle the given Throwable.
- 
Field Details- 
EXCEPTION_HANDLER_METHODSA filter for selecting@ExceptionHandlermethods.
 
- 
- 
Constructor Details- 
ExceptionHandlerMethodResolverA constructor that findsExceptionHandlermethods in the given type.- Parameters:
- handlerType- the type to introspect
 
 
- 
- 
Method Details- 
hasExceptionMappingspublic boolean hasExceptionMappings()Whether the contained type has any exception mappings.
- 
resolveMethodFind aMethodto handle the given exception.Uses ExceptionDepthComparatorif more than one match is found.- Parameters:
- exception- the exception
- Returns:
- a Method to handle the exception, or nullif none found
 
- 
resolveMethodByThrowableFind aMethodto handle the given Throwable.Uses ExceptionDepthComparatorif more than one match is found.- Parameters:
- exception- the exception
- Returns:
- a Method to handle the exception, or nullif none found
- Since:
- 5.0
 
- 
resolveMethodByExceptionTypeFind aMethodto handle the given exception type. This can be useful if anExceptioninstance is not available (e.g. for tools).Uses ExceptionDepthComparatorif more than one match is found.- Parameters:
- exceptionType- the exception type
- Returns:
- a Method to handle the exception, or nullif none found
 
 
-