-
Notifications
You must be signed in to change notification settings - Fork 38.5k
ThreadLocalAccessor implementation for RequestAttributes and LocaleContext #32112
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
Comments
This looks useful to me. It won't work with an SSE controller method because the reactor context gets reset too early. Here an example: https://github.com/scratches/sse-render. |
@ttddyy would you be interested to move that code snippet into an actual PR we can review (with the relevant doc and test). This targets |
Yup, no problem. I'll create a PR for the change. |
Add `ThreadLocalAccessor` implementations: - `LocaleThreadLocalAccessor` - `RequestAttributesThreadLocalAccessor` Closes spring-projectsgh-32112 Signed-off-by: Tadaya Tsuyukubo <[email protected]>
See also #32296 for a related bug. |
In Spring MVC, objects like
RequestAttributes
andLocaleContext
are stored in threadlocal(RequestContextHolder
,LocaleContextHolder
).To support propagation between threadlocal and reactor operation chain, e.g. using
WebClient
in MVC, I have customThreadLocalAccessor
(from micrometer context-propagation) implementations for them.However, it would be more useful if Spring Framework provided them.
Sample Implementations:
The text was updated successfully, but these errors were encountered: