我想对@Cacheable
没有参数的方法进行注释。在这种情况下,我使用 @Cacheable 如下
@Cacheable(value="usercache", key = "mykey")
public string sayHello(){
return "test"
}
但是,当我调用此方法时,它不会被执行,并且会出现如下异常
org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): 在“org.springframework.cache.interceptor.CacheExpressionRootObject”类型的对象上找不到属性或字段“mykey” - 也许不公开?
请建议。