I want to have @Cacheable
annotation on method with no parameter. In that case, I use @Cacheable as follows
@Cacheable(value="usercache", key = "mykey")
public string sayHello(){
return "test"
}
However, when I call this method, it doesn't get executed and it get exception as below
org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'mykey' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject' - maybe not public?
Please suggest.