今天做了个定时批量提交的需求,然后在执行定时任务的时候报了错:
异常信息: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: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
之后根据日志定位是子线程里从request里取了header里的字段所以报错,变成参数从方法外面传进去就可以了