Using a request scoped bean outside of an actual web request

前端 未结 5 809
我在风中等你
我在风中等你 2020-12-09 15:39

I have a web application that has a Spring Integration logic running with it in a separated thread. The problem is that at some point my Spring Integration logic tries to us

5条回答
  •  执念已碎
    2020-12-09 15:55

    Use RequestContextFilter with the property threadContextInheritable set to true. This makes the child thread to inherit the parent's context, which contains the request object itself. Also make sure that the executor doesn't reuse the threads in the pool, because the request object is very specific to that request and cannot be shared across various requests. One such executor is SimpleAsyncTaskExecutor.

    For more info refer Scope 'session' is not active for the current thread; IllegalStateException: No thread-bound request found.

提交回复
热议问题