SSM框架-整合笔记11-配置Redis

配置redis报错

org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field ‘redis_allMenuTree’ cannot be found on object of type ‘org.springframework.cache.interceptor.CacheExpressionRootObject’ - maybe not public?

报错原因

// @Cacheable 上面的错误是因为:注解中key的值变量之前没有加#(井号)

解决

1
2
@Cacheable(value = CACHE_REDIS_PREFIX + "menus", key = "#sysUser.userId")
public List<BaseMenuVo> queryMenuTree(SysUserVo sysUser);