title: What is the best way of defining key for @Cacheable annotation for Spring
body: <p>If I am defining a ehcache for a method which doesn't have any parameter.</p>
  
  <p>But in my use case I needs to access the my built cache through it's key.</p>
  
  <p>So please provide me the better way of assigning key on it.</p>
  
  <p>Follow is my code:</p>
  
  <pre><code>@Override
  @Cacheable(value = "cacheName", key = "cacheKey")
  public List&lt;String&gt; getCacheMethod() throws Exception{
  </code></pre>
  
  <p>P.S. I am getting the following error when I am trying to access this method from somewhere else.</p>
  
  <blockquote>
    <p>org.springframework.expression.spel.SpelEvaluationException: 
    EL1008E:(pos 0): Field or property 'cacheKey' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject'</p>
  </blockquote>