org.springframework.cache.annotation
Class AbstractCachingConfiguration

java.lang.Object
  extended by org.springframework.cache.annotation.AbstractCachingConfiguration
All Implemented Interfaces:
Aware, ImportAware
Direct Known Subclasses:
AspectJCachingConfiguration, ProxyCachingConfiguration

@Configuration
public abstract class AbstractCachingConfiguration
extends Object
implements ImportAware

Abstract base @Configuration class providing common structure for enabling Spring's annotation-driven cache management capability.

Since:
3.1
Author:
Chris Beams
See Also:
EnableCaching

Field Summary
protected  CacheManager cacheManager
           
protected  AnnotationAttributes enableCaching
           
protected  KeyGenerator keyGenerator
           
 
Constructor Summary
AbstractCachingConfiguration()
           
 
Method Summary
protected  void reconcileCacheManager()
          Determine which CacheManager bean to use.
 void setImportMetadata(AnnotationMetadata importMetadata)
          Set the annotation metadata of the importing @Configuration class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enableCaching

protected AnnotationAttributes enableCaching

cacheManager

protected CacheManager cacheManager

keyGenerator

protected KeyGenerator keyGenerator
Constructor Detail

AbstractCachingConfiguration

public AbstractCachingConfiguration()
Method Detail

setImportMetadata

public void setImportMetadata(AnnotationMetadata importMetadata)
Description copied from interface: ImportAware
Set the annotation metadata of the importing @Configuration class.

Specified by:
setImportMetadata in interface ImportAware

reconcileCacheManager

@PostConstruct
protected void reconcileCacheManager()
Determine which CacheManager bean to use. Prefer the result of CachingConfigurer.cacheManager() over any by-type matching. If none, fall back to by-type matching on CacheManager.

Throws:
IllegalArgumentException - if no CacheManager can be found; if more than one CachingConfigurer implementation exists; if multiple CacheManager beans and no CachingConfigurer exists to disambiguate.