Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow annotated methods on a Controller to be marked as exception handlers [SPR-4677] #9354

Closed
spring-projects-issues opened this issue Apr 8, 2008 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 8, 2008

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:

Referenced from: commits f09f4e8

@spring-projects-issues
Copy link
Collaborator Author

Kenny MacLeod commented

Any thoughts on this one?

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

We plan some general enhancements around annotated controllers in Spring 3.0, so I'm scheduling this for 3.0 M2.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants