都可以。
@Autowired HttpServletRequest和作为参数传递是相同的事情。
在传递
HttpServletRequest给响应
@RequestMapping函数的调用方法之前,Spring会将其存储
HttpServletRequest到
ThreadLocal类型变量中。
该
ThreadLocal变量是线程安全的映射,保留
HttpServletRequest在当前线程上下文中。该
@AutowiredHttpServletRequest代理bean会从正确的请求
ThreadLocal变量。



