@Cacheable Null key returned for cache异常的解决方法

#####spring+ehcache缓存@Cacheable等注解在接口interface上报@Cacheable Null key returned for cache异常的解决方法

 

@Cacheable(value ="answerCache", key = "#questionId")
List getAnswerListByQuestion(int questionId, int answerId);

解决方法,key使用变量索引  

@Cacheable(value ="answerCache", key = "#p0")
List getAnswerListByQuestion(int questionId, int answerId);

######原因:猜想可能是jdk在proxy的时候无法解析得到interface中的变量名

转载于:https://my.oschina.net/hackway/blog/664750

你可能感兴趣的:(@Cacheable Null key returned for cache异常的解决方法)