Allow annotated methods on a Controller to be marked as exception handlers [SPR-4677] #9354
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Kenny MacLeod opened SPR-4677 and commented
In some cases, I would like to be able to more tightly bind a controller's exception handling to the controller itself. I am imagining an
@ExceptionHandler
annotation which can be added to a controller's methods, which would be invoked by the framework if the@RequestMapping-annotated
handler methods throw an exception. These annotated methods would be used in preference to the context-wide ExceptionResolvers.This would be particularly useful in controllers with multiple
@RequestMapping
methods, all of which have related exception handling requirements, but which are specific to the controller. Handling this sort of complex exception handling logic in a context-wide ExceptionResolver is decoupling things too much from the source of the exceptions.Thoughts?
Affects: 2.5.3
Issue Links:
@ExceptionHandler
Referenced from: commits f09f4e8
The text was updated successfully, but these errors were encountered: