Springboot项目开启了Spring二级缓存
/**
* 根据用户名查询用户
* @param userName 用户名
* @return 用户信息
*/
@Cacheable(value = "user",key = "userName")
User findByUserName(String userName);
在调用shiro的登陆方法时出现下面的异常
Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - admin, rememberMe=false]. Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'userName' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject' - maybe not public or not valid?
把缓存关闭后问题解决。
记录下方便下次遇到同样问题时查阅。