-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Avoid duplicate registration of @ControllerAdvice implementing both RequestBodyAdvice and ResponseBodyAdvice #22638
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
Conversation
fixbug: duplicate add on ControllerAdvice both RequestBodyAdvice and ResponseBodyAdvice
@liquanchen9 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@liquanchen9 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
Good catch. I'm not sure how often people implement If you could sign the CLA and submit a test that was failing before the change that would be greatly appreciated. |
Since this is a trivial change, @liquanchen9, we have decided to forgo the requirement to sign the CLA. Thanks for your contribution! |
Prior to this commit, if a @ControllerAdvice bean implemented both RequestBodyAdvice and ResponseBodyAdvice, it was only supported as RequestBodyAdvice, meaning it was never invoked as ResponseBodyAdvice. This commit revises RequestResponseBodyAdviceChain to ensure that a single bean implementing both types of body advice is in fact handled as both types of advice. See gh-22638
Prior to this commit, if a @ControllerAdvice bean implemented both RequestBodyAdvice and ResponseBodyAdvice, it was registered twice in RequestMappingHandlerAdapter, leading to duplicate application of the same logic. This commit ensures that such instances are only registered once. Fixes gh-22638
Prior to this commit, if a @ControllerAdvice bean implemented both RequestBodyAdvice and ResponseBodyAdvice, it was only supported as RequestBodyAdvice, meaning it was never invoked as ResponseBodyAdvice. This commit revises RequestResponseBodyAdviceChain to ensure that a single bean implementing both types of body advice is in fact handled as both types of advice. See gh-22638
Prior to this commit, if a @ControllerAdvice bean implemented both RequestBodyAdvice and ResponseBodyAdvice, it was registered twice in RequestMappingHandlerAdapter, leading to duplicate application of the same logic. This commit ensures that such instances are only registered once. Fixes gh-22638
@liquanchen9 Thank you for signing the Contributor License Agreement! |
fixbug: duplicate add on ControllerAdvice both RequestBodyAdvice and ResponseBodyAdvice