Class JCacheAspectSupport
- java.lang.Object
- org.springframework.cache.interceptor.AbstractCacheInvoker
- org.springframework.cache.jcache.interceptor.JCacheAspectSupport
- All Implemented Interfaces:
InitializingBean
- Direct Known Subclasses:
JCacheInterceptor
public class JCacheAspectSupport extends AbstractCacheInvoker implements InitializingBean
Base class for JSR-107 caching aspects, such as theJCacheInterceptoror an AspectJ aspect.Use the Spring caching abstraction for cache-related operations. No JSR-107
CacheorCacheManagerare required to process standard JSR-107 cache annotations.The
JCacheOperationSourceis used for determining caching operationsA cache aspect is serializable if its
JCacheOperationSourceis serializable.- Since:
- 4.1
- Author:
- Stephane Nicoll
- See Also:
CacheAspectSupport,KeyGeneratorAdapter,CacheResolverAdapter
Constructor Summary
Constructors Constructor Description JCacheAspectSupport()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.protected Objectexecute(CacheOperationInvoker invoker, Object target, Method method, Object[] args)JCacheOperationSourcegetCacheOperationSource()Return the CacheOperationSource for this cache aspect.protected ObjectinvokeOperation(CacheOperationInvoker invoker)Execute the underlying operation (typically in case of cache miss) and return the result of the invocation.voidsetCacheOperationSource(JCacheOperationSource cacheOperationSource)Methods inherited from class org.springframework.cache.interceptor.AbstractCacheInvoker
doClear, doEvict, doGet, doPut, getErrorHandler, setErrorHandler
Constructor Detail
JCacheAspectSupport
public JCacheAspectSupport()
Method Detail
setCacheOperationSource
public void setCacheOperationSource(JCacheOperationSource cacheOperationSource)
getCacheOperationSource
public JCacheOperationSource getCacheOperationSource()
Return the CacheOperationSource for this cache aspect.
afterPropertiesSet
public void afterPropertiesSet()
Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSetin interfaceInitializingBean
execute
protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args)
invokeOperation
protected Object invokeOperation(CacheOperationInvoker invoker)
Execute the underlying operation (typically in case of cache miss) and return the result of the invocation. If an exception occurs it will be wrapped in aThrowableWrapper: the exception can be handled or modified but it must be wrapped in aThrowableWrapperas well.- Parameters:
invoker- the invoker handling the operation being cached- Returns:
- the result of the invocation
- See Also:
CacheOperationInvoker.invoke()