<!-- shiro+redis缓存插件 -->
<dependency> <groupId>org.crazycake</groupId> <artifactId>shiro-redis</artifactId> <version>3.1.0</version> </dependency>

由控制图可以看出,所有组件都是由securityManager管理的,所以必须将CacheManager配置到SecurityManager中


解决:在自定义CustomRealm中修改
原有String username = (String)principals.getPrimaryPrincipal();
User user = userService.findAllUserInfoByUsername(username);
改为:

原有return new SimpleAuthenticationInfo(username, user.getPassword(), this.getClass().getName());
改为:

完成!!!
Apache-Shiro CacheManager整合Redis提高性能
原文:https://www.cnblogs.com/woxbwo/p/11421696.html