Skip to content
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

事务参与者中RequestContextHolder.getRequestAttributes()为null #34

Open
kissMeet opened this issue Nov 13, 2018 · 1 comment
Open

Comments

@kissMeet
Copy link

kissMeet commented Nov 13, 2018

RequestContextHolder是一个threadlocal变量,事务参与者是新开线程执行的,传递不过去,需要类似groupId一样,在ActorTxTransactionHandler中传递一下,以便事务参与者可以使用RequestContextHolder。
0s ss za40pm5 _adfu23p

@rench
Copy link

rench commented Nov 16, 2018

  1. 默认 RequestContextFilter 中初始化的RequestContextHolder 里面,没有暴露requestAttributes给子线程。
  2. 如果你需要,可以配置RequestContextFilter 的 threadContextInheritable 属性为true。
  3. spring官方不建议在用线程池的情况下,将threadContextInheritable 设置为true。

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

No branches or pull requests

2 participants