类 CacheProxyFactoryBean
- java.lang.Object
- org.springframework.aop.framework.ProxyConfig
- org.springframework.aop.framework.AbstractSingletonProxyFactoryBean
- org.springframework.cache.interceptor.CacheProxyFactoryBean
- 所有已实现的接口:
Serializable,Aware,BeanClassLoaderAware,BeanFactoryAware,FactoryBean<Object>,InitializingBean,SmartInitializingSingleton
public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean implements BeanFactoryAware, SmartInitializingSingleton
Proxy factory bean for simplified declarative caching handling. This is a convenient alternative to a standard AOPProxyFactoryBeanwith a separateCacheInterceptordefinition.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@Cacheableannotation. See the declarative annotation-based caching section of the Spring reference documentation for more information.- 从以下版本开始:
- 3.1
- 作者:
- Costin Leau, Juergen Hoeller
- 另请参阅:
ProxyFactoryBean,CacheInterceptor, 序列化表格
构造器概要
构造器 构造器 说明 CacheProxyFactoryBean()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidafterSingletonsInstantiated()Invoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already.protected ObjectcreateMainInterceptor()Create the "main" interceptor for this proxy factory bean.voidsetBeanFactory(BeanFactory beanFactory)Callback that supplies the owning factory to a bean instance.voidsetCacheOperationSources(CacheOperationSource... cacheOperationSources)Set one or more sources to find cache operations.voidsetPointcut(Pointcut pointcut)Set a pointcut, i.e. a bean that triggers conditional invocation of theCacheInterceptordepending on the method and attributes passed.从类继承的方法 org.springframework.aop.framework.AbstractSingletonProxyFactoryBean
afterPropertiesSet, createTargetSource, getObject, getObjectType, isSingleton, postProcessProxyFactory, setAdvisorAdapterRegistry, setBeanClassLoader, setPostInterceptors, setPreInterceptors, setProxyClassLoader, setProxyInterfaces, setTarget
从类继承的方法 org.springframework.aop.framework.ProxyConfig
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toString
构造器详细资料
CacheProxyFactoryBean
public CacheProxyFactoryBean()
方法详细资料
setCacheOperationSources
public void setCacheOperationSources(CacheOperationSource... cacheOperationSources)
Set one or more sources to find cache operations.
setPointcut
public void setPointcut(Pointcut pointcut)
Set a pointcut, i.e. a bean that triggers conditional invocation of theCacheInterceptordepending on the method and attributes passed.Note: Additional interceptors are always invoked.
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
从接口复制的说明: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.- 指定者:
setBeanFactory在接口中BeanFactoryAware- 参数:
beanFactory- owning BeanFactory (nevernull). The bean can immediately call methods on the factory.- 另请参阅:
BeanInitializationException
afterSingletonsInstantiated
public void afterSingletonsInstantiated()
从接口复制的说明: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.
createMainInterceptor
protected Object createMainInterceptor()
从类复制的说明:AbstractSingletonProxyFactoryBeanCreate the "main" interceptor for this proxy factory bean. Typically an Advisor, but can also be any type of Advice.Pre-interceptors will be applied before, post-interceptors will be applied after this interceptor.