java.lang.IllegalStateException: No thread-bound request found, exception in aspect

前端 未结 5 1221
不知归路
不知归路 2021-02-02 08:20

Following is my aspect:

    @Configurable
    @Aspect
    public class TimingAspect {

        @Autowired
        private HttpServletRequest httpServletRequest;
         


        
5条回答
  •  春和景丽
    2021-02-02 09:02

    With your pointcut expression, you're basically proxying every bean and applying that advice. Some beans exist and operate outside the context of an HttpServletRequest. This means it cannot be retrieved.

    You can only inject the HttpServletRequest in places where a Servlet container request handling thread will pass through.

提交回复
热议问题