spring-framework / org.springframework.cache.interceptor / CacheProxyFactoryBean

CacheProxyFactoryBean

open class CacheProxyFactoryBean : AbstractSingletonProxyFactoryBean

Proxy factory bean for simplified declarative caching handling. This is a convenient alternative to a standard AOP org.springframework.aop.framework.ProxyFactoryBean with a separate CacheInterceptor definition.

This class is designed to facilitate declarative cache demarcation: namely, wrapping a singleton target object with a caching proxy, proxying all the interfaces that the target implements. Exists primarily for third-party framework integration. Users should favor the cache: XML namespace org.springframework.cache.annotation.Cacheable annotation. See the declarative annotation-based caching section of the Spring reference documentation for more information.

Author
Costin Leau

Author
Juergen Hoeller

Since
3.1

See Also
org.springframework.aop.framework.ProxyFactoryBeanCacheInterceptor

Constructors

<init>

CacheProxyFactoryBean()

Proxy factory bean for simplified declarative caching handling. This is a convenient alternative to a standard AOP org.springframework.aop.framework.ProxyFactoryBean with a separate CacheInterceptor definition.

This class is designed to facilitate declarative cache demarcation: namely, wrapping a singleton target object with a caching proxy, proxying all the interfaces that the target implements. Exists primarily for third-party framework integration. Users should favor the cache: XML namespace org.springframework.cache.annotation.Cacheable annotation. See the declarative annotation-based caching section of the Spring reference documentation for more information.

Functions

setCacheOperationSources

open fun setCacheOperationSources(vararg cacheOperationSources: CacheOperationSource): Unit

Set the sources used to find cache operations.

setPointcut

open fun setPointcut(pointcut: Pointcut): Unit

Set a pointcut, i.e a bean that can cause conditional invocation of the CacheInterceptor depending on method and attributes passed. Note: Additional interceptors are always invoked.

Inherited Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

getObject

open fun getObject(): Any

getObjectType

open fun getObjectType(): Class<*>

isSingleton

fun isSingleton(): Boolean

setAdvisorAdapterRegistry

open fun setAdvisorAdapterRegistry(advisorAdapterRegistry: AdvisorAdapterRegistry): Unit

Specify the AdvisorAdapterRegistry to use. Default is the global AdvisorAdapterRegistry.

setBeanClassLoader

open fun setBeanClassLoader(classLoader: ClassLoader): Unit

setPostInterceptors

open fun setPostInterceptors(postInterceptors: Array<Any>): Unit

Set additional interceptors (or advisors) to be applied after the implicit transaction interceptor.

You may specify any AOP Alliance MethodInterceptors or other Spring AOP Advices, as well as Spring AOP Advisors.

setPreInterceptors

open fun setPreInterceptors(preInterceptors: Array<Any>): Unit

Set additional interceptors (or advisors) to be applied before the implicit transaction interceptor, e.g. a PerformanceMonitorInterceptor.

You may specify any AOP Alliance MethodInterceptors or other Spring AOP Advices, as well as Spring AOP Advisors.

setProxyClassLoader

open fun setProxyClassLoader(classLoader: ClassLoader): Unit

Set the ClassLoader to generate the proxy class in.

Default is the bean ClassLoader, i.e. the ClassLoader used by the containing BeanFactory for loading all bean classes. This can be overridden here for specific proxies.

setProxyInterfaces

open fun setProxyInterfaces(proxyInterfaces: Array<Class<*>>): Unit

Specify the set of interfaces being proxied.

If not specified (the default), the AOP infrastructure works out which interfaces need proxying by analyzing the target, proxying all the interfaces that the target object implements.

setTarget

open fun setTarget(target: Any): Unit

Set the target object, that is, the bean to be wrapped with a transactional proxy.

The target may be any object, in which case a SingletonTargetSource will be created. If it is a TargetSource, no wrapper TargetSource is created: This enables the use of a pooling or prototype TargetSource etc.