Skip to content

Document LocaleContextHolder inheritable behavior#36853

Open
cfcromn wants to merge 1 commit into
spring-projects:mainfrom
cfcromn:docs/locale-context-holder-inheritable
Open

Document LocaleContextHolder inheritable behavior#36853
cfcromn wants to merge 1 commit into
spring-projects:mainfrom
cfcromn:docs/locale-context-holder-inheritable

Conversation

@cfcromn
Copy link
Copy Markdown

@cfcromn cfcromn commented May 29, 2026

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"

Signed-off-by: hamin <hamin090403@gmail.com>
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc: LocaleContextHolder with inheritable only propagates to newly created threads

2 participants