我正在使用 Spring 3。当控制器收到请求时,它会将控制权传递给在 Service bean 中someMethod()
使用注释的方法@Async
,然后返回。当我访问someMethod()
HttpSession 对象时,我收到此异常
java.lang.IllegalStateException: No thread-bound request found: Are you
referring to request attributes outside of an actual web request, or
processing a request outside of the originally receiving thread? If you are
actually operating within a web request and still receive this message, your
code is probably running outside of DispatcherServlet/DispatcherPortlet: In
this case, use RequestContextListener or
RequestContextFilter to expose the current request.
我该如何解决这个问题?