public class CachingConfigurerSupport extends Object implements CachingConfigurer
CachingConfigurer
with empty methods allowing
sub-classes to override only the methods they're interested in.CachingConfigurer
Constructor and Description |
---|
CachingConfigurerSupport() |
Modifier and Type | Method and Description |
---|---|
CacheManager |
cacheManager()
Return the cache manager bean to use for annotation-driven cache
management.
|
CacheResolver |
cacheResolver()
Return the
CacheResolver bean to use to resolve regular caches for
annotation-driven cache management. |
CacheErrorHandler |
errorHandler()
Return the
CacheErrorHandler to use to handle cache-related errors. |
KeyGenerator |
keyGenerator()
Return the key generator bean to use for annotation-driven cache management.
|
@Nullable public CacheManager cacheManager()
CachingConfigurer
CacheResolver
will be initialized
behind the scenes with this cache manager. For more fine-grained
management of the cache resolution, consider setting the
CacheResolver
directly.
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 @
EnableCaching
for more complete examples.cacheManager
in interface CachingConfigurer
@Nullable public KeyGenerator keyGenerator()
CachingConfigurer
@Bean
, e.g.
@Configuration @EnableCaching public class AppConfig extends CachingConfigurerSupport { @Bean // important! @Override public KeyGenerator keyGenerator() { // configure and return KeyGenerator instance } // ... }See @
EnableCaching
for more complete examples.keyGenerator
in interface CachingConfigurer
@Nullable public CacheResolver cacheResolver()
CachingConfigurer
CacheResolver
bean to use to resolve regular caches for
annotation-driven cache management. This is an alternative and more powerful
option of specifying the CacheManager
to use.
If both a CachingConfigurer.cacheManager()
and CachingConfigurer.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 } // ... }See
EnableCaching
for more complete examples.cacheResolver
in interface CachingConfigurer
@Nullable public CacheErrorHandler errorHandler()
CachingConfigurer
CacheErrorHandler
to use to handle cache-related errors.
By default,SimpleCacheErrorHandler
is 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 @
EnableCaching
for more complete examples.errorHandler
in interface CachingConfigurer