阅读 58

redis缓存session,webmvcconfigureradapter 过时

spring boot项目使用ShiroUser shiroUser=(ShiroUser ) principals.getPrimaryPrincipal ()报告错误

错误: Java.lang.classcastexception : com.zyc.spring boot.Shiro.shirousercannotbecasttocom.zyc.spring bot.shyc

虽然不太清楚原因,但暂时发现了三种解决方案:

1 )可能是因为spring boot的热部署。 请尝试消除spring boot的热部署。

2 )使用org.Apache.com mons.beanutils.beanutils类执行属性转换等效于反射数据

object key=principals.getprimaryprincipal (; shirousershirouser=newshirouser (; try { beanutils.copy properties (Shiro user,key ); }catch{exceptione}{}3:会保存当前用户的登录名信息,而不是保存特定对象。

原始代码simpleauthenticationinfosimpleauthenticationinfo=newsimpleauthenticationinfo (Shiro user,user.getPassword ), this新代码simpleauthenticationinfosimpleauthenticationinfo=newsimpleauthenticationinfo (username,user.getPassword ),te


文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐