Class CachingConfigurerSupport
- java.lang.Object
- org.springframework.cache.annotation.CachingConfigurerSupport
- All Implemented Interfaces:
CachingConfigurer
- Direct Known Subclasses:
JCacheConfigurerSupport
public class CachingConfigurerSupport extends Object implements CachingConfigurer
An implementation ofCachingConfigurerwith empty methods allowing sub-classes to override only the methods they're interested in.- Since:
- 4.1
- Author:
- Stephane Nicoll
- See Also:
CachingConfigurer
Constructor Summary
Constructors Constructor Description CachingConfigurerSupport()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CacheManagercacheManager()Return the cache manager bean to use for annotation-driven cache management.CacheResolvercacheResolver()Return theCacheResolverbean to use to resolve regular caches for annotation-driven cache management.CacheErrorHandlererrorHandler()Return theCacheErrorHandlerto use to handle cache-related errors.KeyGeneratorkeyGenerator()Return the key generator bean to use for annotation-driven cache management.
Constructor Detail
CachingConfigurerSupport
public CachingConfigurerSupport()
Method Detail
cacheManager
public CacheManager cacheManager()
Description copied from interface:CachingConfigurerReturn the cache manager bean to use for annotation-driven cache management. A defaultCacheResolverwill be initialized behind the scenes with this cache manager. For more fine-grained management of the cache resolution, consider setting theCacheResolverdirectly.Implementations must explicitly declare
@Bean, e.g.@Configuration @EnableCaching public class AppConfig extends CachingConfigurerSupport { @Bean // important! @Override public CacheManager cacheManager() { // configure and return CacheManager instance } // ... }See @EnableCachingfor more complete examples.- Specified by:
cacheManagerin interfaceCachingConfigurer
cacheResolver
public CacheResolver cacheResolver()
Description copied from interface:CachingConfigurerReturn theCacheResolverbean to use to resolve regular caches for annotation-driven cache management. This is an alternative and more powerful option of specifying theCacheManagerto use.If both a
CachingConfigurer.cacheManager()and#cacheResolver()are set, the cache manager is ignored.Implementations must explicitly declare
@Bean, e.g.@Configuration @EnableCaching public class AppConfig extends CachingConfigurerSupport { @Bean // important! @Override public CacheResolver cacheResolver() { // configure and return CacheResolver instance } // ... }SeeEnableCachingfor more complete examples.- Specified by:
cacheResolverin interfaceCachingConfigurer
keyGenerator
public KeyGenerator keyGenerator()
Description copied from interface:CachingConfigurerReturn the key generator bean to use for annotation-driven cache management. Implementations must explicitly declare@Bean, e.g.@Configuration @EnableCaching public class AppConfig extends CachingConfigurerSupport { @Bean // important! @Override public KeyGenerator keyGenerator() { // configure and return KeyGenerator instance } // ... }See @EnableCachingfor more complete examples.- Specified by:
keyGeneratorin interfaceCachingConfigurer
errorHandler
public CacheErrorHandler errorHandler()
Description copied from interface:CachingConfigurerReturn theCacheErrorHandlerto use to handle cache-related errors.By default,
SimpleCacheErrorHandleris used and simply throws the exception back at the client.Implementations must explicitly declare
@Bean, e.g.@Configuration @EnableCaching public class AppConfig extends CachingConfigurerSupport { @Bean // important! @Override public CacheErrorHandler errorHandler() { // configure and return CacheErrorHandler instance } // ... }See @EnableCachingfor more complete examples.- Specified by:
errorHandlerin interfaceCachingConfigurer