public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSource implements InitializingBean, ApplicationContextAware
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).
|
protected <T> T |
getBean(Class<T> type)
Locate or create an instance of the specified
type . |
CacheResolver |
getCacheResolver() |
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() |
KeyGenerator |
getKeyGenerator() |
void |
setApplicationContext(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
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, getExceptionCacheResolver
allowPublicMethodsOnly, getCacheOperation
public void setCacheManager(CacheManager cacheManager)
CacheManager
to use to lookup cache by name. Only mandatory
if the cache resolvers have not been set.public void setKeyGenerator(KeyGenerator keyGenerator)
KeyGenerator
. If none is set, a SimpleKeyGenerator
honoringKe the JSR-107 CacheKey
and
CacheValue
will be used.public KeyGenerator getKeyGenerator()
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 setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAware
Invoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)
,
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
and
MessageSourceAware
, if applicable.
setApplicationContext
in interface ApplicationContextAware
applicationContext
- the ApplicationContext object to be used by this objectBeanInitializationException
public void afterPropertiesSet()
InitializingBean
This 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 InitializingBean
protected <T> T getBean(Class<T> type)
AnnotationJCacheOperationSource
type
.getBean
in class AnnotationJCacheOperationSource
type
- the type of the bean to manageprotected CacheResolver getDefaultCacheResolver()
AnnotationJCacheOperationSource
CacheResolver
if none is set.getDefaultCacheResolver
in class AnnotationJCacheOperationSource
protected CacheResolver getDefaultExceptionCacheResolver()
AnnotationJCacheOperationSource
CacheResolver
if none is set.getDefaultExceptionCacheResolver
in class AnnotationJCacheOperationSource
protected KeyGenerator getDefaultKeyGenerator()
AnnotationJCacheOperationSource
KeyGenerator
if none is set.getDefaultKeyGenerator
in class AnnotationJCacheOperationSource