title: spring cache with custom cacheResolver
body: <p>I wand to have dynamic cache names, and spring <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html" rel="nofollow">4.1 allows that</a></p>
  
  <blockquote>
    <p>Since Spring 4.1, the value attribute of the cache annotations are no longer mandatory since this particular information can be provided by the CacheResolver regardless of the content of the annotation.</p>
  </blockquote>
  
  <p>Notice how I paranoidly set <code>cacheResolver</code> on all possible levels:</p>
  
  <pre><code>@Cacheable(cacheResolver = "defaultCacheResolver")
  @CacheConfig(cacheResolver = "defaultCacheResolver")
  public interface GatewayRepository extends CrudRepository&lt;Gateway, Integer&gt; {
      @Cacheable(cacheResolver = "defaultCacheResolver")
      Gateway findByBulkId(int bulkId);
  }
  </code></pre>
  
  <p>Spring 4.1.5 still fails to validate the config with error: <code>Caused by: java.lang.IllegalStateException: No cache names could be detected on 'public abstract skunkworks.data.Gateway skunkworks.repos.GatewayRepository.findByBulkId(int)'. Make sure to set the value parameter on the annotation or declare a @CacheConfig at the class-level with the default cache name(s) to use.
      at org.springframework.cache.annotation.SpringCacheAnnotationParser.validateCacheOperation(SpringCacheAnnotationParser.java:240)</code></p>