GH-36738: Document rendering-scope limitation of WebFlux RequestContext.changeLocale()#36894
Open
won-seoop wants to merge 1 commit into
Open
Conversation
…ux RequestContext.changeLocale() The Spring MVC RequestContext.changeLocale() delegates through the configured LocaleResolver and persists the locale across requests. The WebFlux equivalent only updates a field on the current RequestContext instance and the change is discarded at the end of the rendering cycle. This asymmetry was undocumented, leading developers to expect that calling changeLocale() in a WebFlux template would produce the same durable effect as in Spring MVC. Add Javadoc to both WebFlux overloads explaining that the change affects only the current rendering context, does not delegate to a LocaleContextResolver, and pointing developers towards the correct approach (WebFilter + LocaleContextResolver) for durable locale changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #36738.
The Spring MVC
RequestContext.changeLocale()delegates through the configuredLocaleResolver, persisting the new locale for subsequent requests. The WebFlux equivalent updates only a private field on the currentRequestContextinstance; the change is silently discarded at the end of the rendering cycle. This asymmetry was undocumented, causing developers to expect the same durable behavior as in MVC.This PR adds Javadoc to both
changeLocaleoverloads inorg.springframework.web.reactive.result.view.RequestContext, clearly documenting:LocaleContextResolver.LocaleContextResolverand update it from aWebFilteror handler method.Spring MVC's
RequestContext.changeLocale()already has explicit Javadoc (including@see LocaleResolver#setLocale) — this PR closes the MVC/WebFlux documentation parity gap for this method.Test plan
🤖 Generated with Claude Code