Shiro(3) controller中获取当前登录用户信息

//Shiro controller中获取当前登录用户信息

方式一:

    @RequestMapping(value = "/competitorPageList" ) 
    public String competitorPageList(Model model, ) {

 Long currentUserId = (Long) SecurityUtils.getSubject().getSession().getAttribute("currentUserId"); 
 }

方式二:

 @RequestMapping(value = "/competitorPageList" ) 
    public String competitorPageList(Model model,HttpServletRequest request ) { 
Long currentUserId = (Long) request.getSession().getAttribute("currentUserId");
       }

版权声明:本文为fengcai0123原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。