Have ExceptionHandlerMethodResolver use most-specific ExceptionHandler method [SPR-11016] #15644
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: bulk-closed
An outdated, unresolved issue that's closed in bulk as part of a cleaning process
Deejay opened SPR-11016 and commented
It'd be good to have exceptions handled by the
@ExceptionHandler
with the most specific exception type defined. At the moment, it appears to be handled by whichever handler it finds first that can deal with any type in the exception's ancestry.Jersey's similar
ExceptionMapper
mechanism iterates over each handler, then iterates up the type ancestry of the exception, counting as it goes. The handler with the shortest distance between the exception's actual type and the handled type wins and is returned. This could be cached for efficiency.Reference URL: http://stackoverflow.com/questions/19498378/setting-precedence-of-multiple-controlleradvice-exceptionhandlers/19500823
The text was updated successfully, but these errors were encountered: