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
Have ExceptionHandlerMethodResolver use most-specific ExceptionHandler method [SPR-11016] #15644
Comments
Rossen Stoyanchev commented The logic for selecting Can you provide a concrete example? A executable example would be best but code snippets of controller and exception handling method signatures would be okay as well. |
Deejay commented Hi, I've raised a pull request for the Spring Framework Issues repo with a small project that demonstrates the issue. There are three tests in BTW Maven didn't pick up the tests on the command line, but did through STS. |
Rossen Stoyanchev commented Thanks for the example! The tests pass for me but despite that they show me exactly what you mean. The feature was designed to work like this. The first On a related note we have also recently added more fine-grained control over what controllers an I'd be interested to know if your use case can be served by the above? |
Bulk closing outdated, unresolved issues. Please, reopen if still relevant. |
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: