

























加入Shiro框架Redis 注解方式缓存不能工作,如@Cacheable无法写入缓存,原因是所在类在Shiro的自定义Realm类中已经@Autowire了所在类。解决方式,在自定义Realm类中注入所在类时,加入@Lazy使用懒加载的方式。
@Component
public class AuthRealm extends AuthorizingRealm {
@Autowired
@Lazy
private IUserService userService;
@Autowired
@Lazy
private IUserRoleService userRoleService;
@Autowired
@Lazy
private IMenuService menuService;
@Autowired
@Lazy
private IRoleService roleService;
//....
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。