public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSource implements BeanFactoryAware, InitializingBean, SmartInitializingSingleton
JCacheOperationSource implementation delegating
default operations to configurable services with sensible defaults
when not present.logger| Constructor and Description |
|---|
DefaultJCacheOperationSource() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
void |
afterSingletonsInstantiated()
Invoked right at the end of the singleton pre-instantiation phase,
with a guarantee that all regular singleton beans have been created
already.
|
protected <T> T |
getBean(Class<T> type)
Locate or create an instance of the specified cache strategy
type. |
CacheManager |
getCacheManager()
Return the specified cache manager to use, if any.
|
CacheResolver |
getCacheResolver()
Return the specified cache resolver to use, if any.
|
protected CacheManager |
getDefaultCacheManager() |
protected CacheResolver |
getDefaultCacheResolver()
Return the default
CacheResolver if none is set. |
protected CacheResolver |
getDefaultExceptionCacheResolver()
Return the default exception
CacheResolver if none is set. |
protected KeyGenerator |
getDefaultKeyGenerator()
Return the default
KeyGenerator if none is set. |
CacheResolver |
getExceptionCacheResolver()
Return the specified exception cache resolver to use, if any.
|
KeyGenerator |
getKeyGenerator()
Return the specified key generator to use, if any.
|
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.
|
void |
setCacheManager(CacheManager cacheManager)
Set the default
CacheManager to use to lookup cache by name. |
void |
setCacheResolver(CacheResolver cacheResolver)
Set the
CacheResolver to resolve regular caches. |
void |
setExceptionCacheResolver(CacheResolver exceptionCacheResolver)
Set the
CacheResolver to resolve exception caches. |
void |
setKeyGenerator(KeyGenerator keyGenerator)
Set the default
KeyGenerator. |
createCachePutOperation, createCacheRemoveAllOperation, createCacheRemoveOperation, createCacheResultOperation, determineCacheName, determineCacheResolverFactory, determineKeyGenerator, findCacheOperation, generateDefaultCacheName, getCacheDefaults, getCacheResolver, getExceptionCacheResolverallowPublicMethodsOnly, getCacheOperationpublic void setCacheManager(CacheManager cacheManager)
CacheManager to use to lookup cache by name. Only mandatory
if the cache resolvers have not been set.public CacheManager getCacheManager()
public void setCacheResolver(CacheResolver cacheResolver)
CacheResolver to resolve regular caches. If none is set, a default
implementation using the specified cache manager will be used.public CacheResolver getCacheResolver()
public void setExceptionCacheResolver(CacheResolver exceptionCacheResolver)
CacheResolver to resolve exception caches. If none is set, a default
implementation using the specified cache manager will be used.public CacheResolver getExceptionCacheResolver()
public void setKeyGenerator(KeyGenerator keyGenerator)
KeyGenerator. If none is set, a SimpleKeyGenerator
honoring the JSR-107 CacheKey and
CacheValue will be used.public KeyGenerator getKeyGenerator()
public void setBeanFactory(BeanFactory beanFactory)
BeanFactoryAwareInvoked after the population of normal bean properties
but before an initialization callback such as
InitializingBean.afterPropertiesSet() or a custom init-method.
setBeanFactory in interface BeanFactoryAwarebeanFactory - owning BeanFactory (never null).
The bean can immediately call methods on the factory.BeanInitializationExceptionpublic void afterPropertiesSet()
InitializingBeanThis method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet in interface InitializingBeanpublic void afterSingletonsInstantiated()
SmartInitializingSingletonListableBeanFactory.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 BeanFactory bootstrap,
and not for any other bean scope either. Carefully use it for beans
with the intended bootstrap semantics only.
afterSingletonsInstantiated in interface SmartInitializingSingletonprotected <T> T getBean(Class<T> type)
AnnotationJCacheOperationSourcetype.getBean in class AnnotationJCacheOperationSourcetype - the type of the bean to manageprotected CacheManager getDefaultCacheManager()
protected CacheResolver getDefaultCacheResolver()
AnnotationJCacheOperationSourceCacheResolver if none is set.getDefaultCacheResolver in class AnnotationJCacheOperationSourceprotected CacheResolver getDefaultExceptionCacheResolver()
AnnotationJCacheOperationSourceCacheResolver if none is set.getDefaultExceptionCacheResolver in class AnnotationJCacheOperationSourceprotected KeyGenerator getDefaultKeyGenerator()
AnnotationJCacheOperationSourceKeyGenerator if none is set.getDefaultKeyGenerator in class AnnotationJCacheOperationSource