reidis设置key org.springframework.expression.spel.SpelEvaluationException: EL1008E

本文章转载自菜菜菜菜菜鸡:https://blog.csdn.net/qq_24084605/article/details/81002690?utm_source=distribute.pc_relevant.none-task

在使用springboot集成redis,service实现层增加@Cacheable注解中的key,以为可以自定义,随便写写,在运行时

key org.springframework.expression.spel.SpelEvaluationException: EL1008E

改之前
@Cacheable(value = “user_list”,key =“findAll”, unless = “#result==null”)// findAll为注解的方法名

改之后
@Cacheable(value = “user_list”,key ="#root.methodName", unless = “#result==null”)//必须通过root.methodName获取方法名或者
,key=“数字”,也可以