Class DefaultJCacheOperationSource
java.lang.Object
org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSource
org.springframework.cache.jcache.interceptor.AnnotationJCacheOperationSource
org.springframework.cache.jcache.interceptor.DefaultJCacheOperationSource
- All Implemented Interfaces:
- Aware,- BeanFactoryAware,- SmartInitializingSingleton,- JCacheOperationSource
public class DefaultJCacheOperationSource
extends AnnotationJCacheOperationSource
implements BeanFactoryAware, SmartInitializingSingleton
The default 
JCacheOperationSource implementation delegating
 default operations to configurable services with sensible defaults
 when not present.- Since:
- 4.1
- Author:
- Stephane Nicoll, Juergen Hoeller
- 
Field SummaryFields inherited from class org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSourcelogger
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct a newDefaultJCacheOperationSourcewith the default key generator.DefaultJCacheOperationSource(Supplier<CacheManager> cacheManager, Supplier<CacheResolver> cacheResolver, Supplier<CacheResolver> exceptionCacheResolver, Supplier<KeyGenerator> keyGenerator) Construct a newDefaultJCacheOperationSourcewith the given cache manager, cache resolver and key generator suppliers, applying the corresponding default if a supplier is not resolvable.
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already.protected <T> TLocate or create an instance of the specified cache strategytype.Return the specified cache manager to use, if any.Return the specified cache resolver to use, if any.protected CacheManagerprotected CacheResolverReturn the defaultCacheResolverif none is set.protected CacheResolverReturn the default exceptionCacheResolverif none is set.protected KeyGeneratorReturn the defaultKeyGeneratorif none is set.Return the specified exception cache resolver to use, if any.Return the specified key generator to use.voidsetBeanFactory(BeanFactory beanFactory) Callback that supplies the owning factory to a bean instance.voidsetCacheManager(CacheManager cacheManager) Set the defaultCacheManagerto use to lookup cache by name.voidsetCacheResolver(CacheResolver cacheResolver) Set theCacheResolverto resolve regular caches.voidsetExceptionCacheResolver(CacheResolver exceptionCacheResolver) Set theCacheResolverto resolve exception caches.voidsetKeyGenerator(KeyGenerator keyGenerator) Set the defaultKeyGenerator.Methods inherited from class org.springframework.cache.jcache.interceptor.AnnotationJCacheOperationSourcecreateCachePutOperation, createCacheRemoveAllOperation, createCacheRemoveOperation, createCacheResultOperation, determineCacheName, determineCacheResolverFactory, determineKeyGenerator, findCacheOperation, generateDefaultCacheName, getCacheDefaults, getCacheResolver, getExceptionCacheResolver, isCandidateClassMethods inherited from class org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSourceallowPublicMethodsOnly, getCacheOperation, hasCacheOperation
- 
Constructor Details- 
DefaultJCacheOperationSourcepublic DefaultJCacheOperationSource()Construct a newDefaultJCacheOperationSourcewith the default key generator.- See Also:
 
- 
DefaultJCacheOperationSourcepublic DefaultJCacheOperationSource(@Nullable Supplier<CacheManager> cacheManager, @Nullable Supplier<CacheResolver> cacheResolver, @Nullable Supplier<CacheResolver> exceptionCacheResolver, @Nullable Supplier<KeyGenerator> keyGenerator) Construct a newDefaultJCacheOperationSourcewith the given cache manager, cache resolver and key generator suppliers, applying the corresponding default if a supplier is not resolvable.- Since:
- 5.1
 
 
- 
- 
Method Details- 
setCacheManagerSet the defaultCacheManagerto use to lookup cache by name. Only mandatory if the cache resolver has not been set.
- 
getCacheManagerReturn the specified cache manager to use, if any.
- 
setCacheResolverSet theCacheResolverto resolve regular caches. If none is set, a default implementation using the specified cache manager will be used.
- 
getCacheResolverReturn the specified cache resolver to use, if any.
- 
setExceptionCacheResolverSet theCacheResolverto resolve exception caches. If none is set, a default implementation using the specified cache manager will be used.
- 
getExceptionCacheResolverReturn the specified exception cache resolver to use, if any.
- 
setKeyGeneratorSet the defaultKeyGenerator. If none is set, aSimpleKeyGeneratorhonoring the JSR-107CacheKeyandCacheValuewill be used.
- 
getKeyGeneratorReturn the specified key generator to use.
- 
setBeanFactoryDescription copied from interface:BeanFactoryAwareCallback that supplies the owning factory to a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean.afterPropertiesSet()or a custom init-method.- Specified by:
- setBeanFactoryin interface- BeanFactoryAware
- Parameters:
- beanFactory- owning BeanFactory (never- null). The bean can immediately call methods on the factory.
- See Also:
 
- 
afterSingletonsInstantiatedpublic void afterSingletonsInstantiated()Description copied from interface:SmartInitializingSingletonInvoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already.ListableBeanFactory.getBeansOfType(java.lang.Class<T>)calls within this method won't trigger accidental side effects during bootstrap.NOTE: This callback won't be triggered for singleton beans lazily initialized on demand after BeanFactorybootstrap, and not for any other bean scope either. Carefully use it for beans with the intended bootstrap semantics only.- Specified by:
- afterSingletonsInstantiatedin interface- SmartInitializingSingleton
 
- 
getBeanDescription copied from class:AnnotationJCacheOperationSourceLocate or create an instance of the specified cache strategytype.- Specified by:
- getBeanin class- AnnotationJCacheOperationSource
- Parameters:
- type- the type of the bean to manage
- Returns:
- the required bean
 
- 
getDefaultCacheManager
- 
getDefaultCacheResolverDescription copied from class:AnnotationJCacheOperationSourceReturn the defaultCacheResolverif none is set.- Specified by:
- getDefaultCacheResolverin class- AnnotationJCacheOperationSource
 
- 
getDefaultExceptionCacheResolverDescription copied from class:AnnotationJCacheOperationSourceReturn the default exceptionCacheResolverif none is set.- Specified by:
- getDefaultExceptionCacheResolverin class- AnnotationJCacheOperationSource
 
- 
getDefaultKeyGeneratorDescription copied from class:AnnotationJCacheOperationSourceReturn the defaultKeyGeneratorif none is set.- Specified by:
- getDefaultKeyGeneratorin class- AnnotationJCacheOperationSource
 
 
-