@Configuration public abstract class AbstractCachingConfiguration<C extends CachingConfigurer> extends Object implements ImportAware
@Configuration
class providing common structure for enabling
Spring's annotation-driven cache management capability.EnableCaching
Modifier and Type | Field and Description |
---|---|
protected CacheManager |
cacheManager |
protected CacheResolver |
cacheResolver |
protected AnnotationAttributes |
enableCaching |
protected CacheErrorHandler |
errorHandler |
protected KeyGenerator |
keyGenerator |
Constructor and Description |
---|
AbstractCachingConfiguration() |
Modifier and Type | Method and Description |
---|---|
protected void |
reconcileCacheManager()
Determine which
CacheManager bean to use. |
void |
setImportMetadata(AnnotationMetadata importMetadata)
Set the annotation metadata of the importing @
Configuration class. |
protected void |
useCachingConfigurer(C config)
Extract the configuration from the nominated
CachingConfigurer . |
protected AnnotationAttributes enableCaching
protected CacheManager cacheManager
protected CacheResolver cacheResolver
protected KeyGenerator keyGenerator
protected CacheErrorHandler errorHandler
public void setImportMetadata(AnnotationMetadata importMetadata)
ImportAware
Configuration
class.setImportMetadata
in interface ImportAware
@PostConstruct protected void reconcileCacheManager()
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
.IllegalArgumentException
- if no CacheManager can be found; if more than one
CachingConfigurer implementation exists; if multiple CacheManager beans and no
CachingConfigurer exists to disambiguate.protected void useCachingConfigurer(C config)
CachingConfigurer
.