Example usage for org.springframework.cache.interceptor CacheResolver resolveCaches

List of usage examples for org.springframework.cache.interceptor CacheResolver resolveCaches

Introduction

In this page you can find the example usage for org.springframework.cache.interceptor CacheResolver resolveCaches.

Prototype

Collection<? extends Cache> resolveCaches(CacheOperationInvocationContext<?> context);

Source Link

Document

Return the cache(s) to use for the specified invocation.

Usage

From source file:org.springframework.cache.interceptor.CacheAspectSupport.java

protected Collection<? extends Cache> getCaches(CacheOperationInvocationContext<CacheOperation> context,
        CacheResolver cacheResolver) {

    Collection<? extends Cache> caches = cacheResolver.resolveCaches(context);
    if (caches.isEmpty()) {
        throw new IllegalStateException(
                "No cache could be resolved for '" + context.getOperation() + "' using resolver '"
                        + cacheResolver + "'. At least one cache should be provided per cache operation.");
    }// w w  w.  j av a 2s  .c  om
    return caches;
}