Request的获取
- 第一种方法
@Autowired private HttpServletRequest request;
- 第二种方法
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); HttpSession session= ((ServletRequestAttributes)requestAttributes).getRequest().getSession();