Class AbstractExceptionHandlerMethodResolver
java.lang.Object
org.springframework.messaging.handler.invocation.AbstractExceptionHandlerMethodResolver
- Direct Known Subclasses:
AnnotationExceptionHandlerMethodResolver
Cache exception handling method mappings and provide options to look up a method
that should handle an exception. If multiple methods match, they are sorted using
ExceptionDepthComparator and the top match is returned.- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Juergen Hoeller, Sam Brannen
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractExceptionHandlerMethodResolver(Map<Class<? extends Throwable>, Method> mappedMethods) Protected constructor accepting exception-to-method mappings. -
Method Summary
Modifier and TypeMethodDescriptionExtract the exceptions this method handles.booleanWhether the contained type has any exception mappings.resolveMethod(Throwable exception) Find aMethodto handle the given exception.resolveMethodByExceptionType(Class<? extends Throwable> exceptionType) Find aMethodto handle the given exception type.
-
Constructor Details
-
AbstractExceptionHandlerMethodResolver
-
-
Method Details
-
getExceptionsFromMethodSignature
-
hasExceptionMappings
public boolean hasExceptionMappings()Whether the contained type has any exception mappings. -
resolveMethod
Find 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
-
resolveMethodByExceptionType
Find aMethodto handle the given exception type. This can be useful if anExceptioninstance is not available (for example, 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 - Since:
- 4.3.1
-