Java 同类型的对象无法强转????
資深大佬 : ChunkitAu 59
在 SpringBoot 整合 Shiro 时报错
java.lang.ClassCastException: com.chunkit.show_web.entity.User cannot be cast to com.chunkit.show_web.entity.User
报异常的句子 user = (User)((SimplePrincipalCollection) attribute).getPrimaryPrincipal();
attribute::
attribute = {[email protected]} “User(userid=3, username=admin, password=4af009edcc2fc527d84e93f6b7f04b8c1c22607258776512a1f2ab7b86eef309, accountname=admin)” realmPrincipals = {[email protected]} size = 1 “com.chunkit.show_web.auth.shiro.CustomRealm_0” -> {[email protected]} size = 1 cachedToString = “User(userid=3, username=admin, password=4af009edcc2fc527d84e93f6b7f04b8c1c22607258776512a1f2ab7b86eef309, accountname=admin)”
求解
大佬有話說 (2)