SPR-7278 extension hook to extend the @ExceptionHandler methods for a controller
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4571 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
c287a3c71b
commit
82339ea9bf
|
|
@ -264,12 +264,23 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
|
||||||
ExceptionMethodMapping mapping = exceptionMethodMappingCache.get(handlerType);
|
ExceptionMethodMapping mapping = exceptionMethodMappingCache.get(handlerType);
|
||||||
if (mapping == null) {
|
if (mapping == null) {
|
||||||
Set<Method> methods = HandlerMethodSelector.selectMethods(handlerType, EXCEPTION_HANDLER_METHODS);
|
Set<Method> methods = HandlerMethodSelector.selectMethods(handlerType, EXCEPTION_HANDLER_METHODS);
|
||||||
|
extendExceptionHandlerMethods(methods, handlerType);
|
||||||
mapping = new ExceptionMethodMapping(methods);
|
mapping = new ExceptionMethodMapping(methods);
|
||||||
exceptionMethodMappingCache.put(handlerType, mapping);
|
exceptionMethodMappingCache.put(handlerType, mapping);
|
||||||
}
|
}
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension hook that subclasses can override to register additional @{@link ExceptionHandler} methods
|
||||||
|
* by controller type. By default only @{@link ExceptionHandler} methods from the same controller are
|
||||||
|
* included.
|
||||||
|
* @param methods the list of @{@link ExceptionHandler} methods detected in the controller allowing to add more
|
||||||
|
* @param handlerType the controller type to which the @{@link ExceptionHandler} methods will apply
|
||||||
|
*/
|
||||||
|
protected void extendExceptionHandlerMethods(Set<Method> methods, Class<?> handlerType) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MethodFilter that matches {@link ExceptionHandler @ExceptionHandler} methods.
|
* MethodFilter that matches {@link ExceptionHandler @ExceptionHandler} methods.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue