后端session的获取

Request的获取

  • 第一种方法
@Autowired
    private  HttpServletRequest request;
  • 第二种方法
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        HttpSession  session= ((ServletRequestAttributes)requestAttributes).getRequest().getSession();
posted @ 2017-09-22 20:05  纵码万水千山  阅读(2793)  评论(0编辑  收藏  举报