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

MVC config should register custom arguments resolvers with default ExceptionHandlerExceptionResolver [SPR-12058] #16674

spring-projects-issues opened this issue Aug 2, 2014 · 2 comments
in: web type: enhancement


Copy link

spring-projects-issues commented Aug 2, 2014

Jakub Narloch opened SPR-12058 and commented

Apparently the ExceptionHandlerExceptionResolver despite having the proper #setCustomArgumentResolvers does not register the arguments resolver that are being registered within web application through WebMvcConfigurerAdapters.

Whether this has been done for purpose, I think that this could be extended to allow additional argument resolutions in the error handling methods like for instance:

Affects: 4.0.6, 4.2.4

Issue Links:

  • SEC-2696 Can not inject @AuthenticationPrincipal into @ExceptionHandler method. ("is duplicated by")

Referenced from: pull request #615, and commits 1cf0fb8

Copy link
Collaborator Author

spring-projects-issues commented Aug 2, 2014

Jakub Narloch commented

I've linked the pull request: #615

Copy link
Collaborator Author

spring-projects-issues commented Aug 18, 2014

Rossen Stoyanchev commented

An @RequestMapping method supports a much wider range of argument types (@ExceptionHandler only registers request and response related argument resolvers) so they are different sets. The javadoc on WebMvcConfigurer is also quite explicit that it only applies to RequestMappingHandlerAdapter.

That said it might be okay to apply this change as an improvement since custom argument resolvers, which are invoked after built-in ones, would have be of a specific type or have a specific annotation. Hence registering custom resolvers shouldn't cause any harm. For consistency the change should also apply to the MVC XML namespace as well custom HandlerMethodReturnValueHandler's.

@spring-projects-issues spring-projects-issues added type: enhancement in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3 RC1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: web type: enhancement
None yet

No branches or pull requests

2 participants