Skip to content

Document LocaleContextHolder inheritable behavior - #36853

Merged
bclozel merged 2 commits into
spring-projects:mainfrom
cfcromn:docs/locale-context-holder-inheritable
Oct 21, 2026
Merged

bclozel merged 2 commits into
spring-projects:mainfrom
cfcromn:docs/locale-context-holder-inheritable

Conversation

@cfcromn

@cfcromn cfcromn commented May 29, 2026

Copy link
Copy Markdown
Contributor

Closes #36687

This change documents that LocaleContextHolder's inheritable flag relies on
JDK InheritableThreadLocal semantics, which only propagate values to newly
created child threads at the time of their creation.

In thread pool environments where threads are reused across tasks, the context
is not refreshed per task submission, so this mechanism is not suitable for
per-task context propagation to reused threads.

The documentation now points users toward TaskDecorator for explicit per-task
locale context propagation.

Verification:

  • ./gradlew :spring-context:compileJava
  • ./gradlew :spring-context:test --tests "org.springframework.context.i18n.LocaleContextHolderTests"

@cfcromn
cfcromn force-pushed the docs/locale-context-holder-inheritable branch from 15bfc38 to 02c4b50 Compare May 29, 2026 00:44
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 29, 2026
@cfcromn

cfcromn commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Hi team, just checking whether this PR is aligned with the intended direction for #36687.

The change is intentionally limited to documenting the existing InheritableThreadLocal behavior and pointing users to TaskDecorator for per-task propagation in reused thread-pool scenarios.

Happy to adjust the wording or location if there is a preferred place for this documentation.

@bclozel bclozel added the in: core Issues in core modules (aop, beans, core, context, expression) label Aug 27, 2026
Signed-off-by: hamin <hamin090403@gmail.com>
@bclozel bclozel self-assigned this Oct 21, 2026
@bclozel bclozel added type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 21, 2026
@bclozel bclozel added this to the 7.1.0-RC2 milestone Oct 21, 2026
Mention that the `inheritable` flag works with virtual threads, detail
the expected `TaskDecorator` behavior and remove an HTML entity.

See spring-projectsgh-36853
@bclozel
bclozel force-pushed the docs/locale-context-holder-inheritable branch from 02c4b50 to 12dc951 Compare October 21, 2026 11:22
@bclozel
bclozel merged commit 12dc951 into spring-projects:main Oct 21, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) type: documentation A documentation task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc: LocaleContextHolder with inheritable only propagates to newly created threads

3 participants