Skip to content

GH-3954: Fix WebFlux XML config for ambiguity #3973

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

Merged
merged 2 commits into from
Dec 15, 2022

Conversation

artembilan
Copy link
Member

Fixes #3954

When web-client attribute is provided for the WebFlux outbound components configuration via XML, the encoding-mode is silently ignored

  • Check for encoding-mode attribute presence in the WebFluxOutboundChannelAdapterParser when web-client is provided and throw respective exception to reject such a config

Cherry-pick to 5.5.x

Fixes spring-projects#3954

When `web-client` attribute is provided for the WebFlux outbound components configuration via XML,
the `encoding-mode` is silently ignored

* Check for `encoding-mode` attribute presence in the `WebFluxOutboundChannelAdapterParser`
when `web-client` is provided and throw respective exception to reject such a config

**Cherry-pick to `5.5.x`**
Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change.

@@ -51,6 +51,11 @@ static BeanDefinitionBuilder buildWebFluxRequestExecutingMessageHandler(Element

String webClientRef = element.getAttribute("web-client");
if (StringUtils.hasText(webClientRef)) {
if (element.hasAttribute("encoding-mode")) {
parserContext.getReaderContext()
.error("The 'web-client' and 'encoding-mode' are mutually exclusive.", element);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.error("The 'web-client' and 'encoding-mode' are mutually exclusive.", element);
.error("The 'web-client' and 'encoding-mode' attributes are mutually exclusive.", element);

@garyrussell garyrussell merged commit 4cd0029 into spring-projects:main Dec 15, 2022
garyrussell pushed a commit that referenced this pull request Dec 15, 2022
* GH-3954: Fix WebFlux XML config for ambiguity

Fixes #3954

When `web-client` attribute is provided for the WebFlux outbound components configuration via XML,
the `encoding-mode` is silently ignored

* Check for `encoding-mode` attribute presence in the `WebFluxOutboundChannelAdapterParser`
when `web-client` is provided and throw respective exception to reject such a config

**Cherry-pick to `5.5.x`**

* * Improve error messages in the `WebFluxOutboundChannelAdapterParser`
@garyrussell
Copy link
Contributor

...and cherry-picked as 626b14e after resolving test conflicts and import order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebFluxOutboundChannelAdapterParser silently ignores encoding-mode attribute if web-client attribute is present
3 participants