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

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

Long currentUserId = (Long) SecurityUtils.getSubject().getSession().getAttribute("currentUserId");
}
1
2
3
4
5
方式二:

@RequestMapping(value = "/competitorPageList" )
public String competitorPageList(Model model,HttpServletRequest request ) {
Long currentUserId = (Long) request.getSession().getAttribute("currentUserId");
}
————————————————
版权声明:本文为CSDN博主「fengcai0123」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/fengcai0123/article/details/75235861

原文地址:https://www.cnblogs.com/gzhbk/p/12767165.html