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  Map<String,Object> enableCaching
          Parsed annotation metadata for @EnableCaching on the importing class.
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 Map<String,Object> enableCaching
Parsed annotation metadata for @EnableCaching on the importing class.


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.