Spring ProxyFactoryBean 的属性 interceptorNames 的属性值

[size=medium]ProxyFactoryBean 代理工厂的属性 interceptorNames的值的范围 例子如下:[/size]

<bean id="roleService"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces"
value="com.future.egov.zhengxeq.zyxt.business.service.orm.RoleService" />
<property name="target">
<bean
class="com.future.egov.zhengxeq.zyxt.business.service.orm.OrmServiceImpl" />
</property>
<property name="interceptorNames">
<list>
<value>decorateBeforeAdvice</value>
<value>transactionAdvisor</value>
<value>roleDecorateInterceptor</value>
</list>
</property>
</bean>


[size=medium]interceptorNames 属性的list集合里面只能放 通知/通知者 。
通知/通知者被称为拦截者(拦截器)。
spring in action 翻译的书里面说集合成员是拦截者/通知者 这是错误的。概念不清晰,希望大家注意一下。


以下是源码里面的解释如下:[/size]

/**
* Set the list of Advice/Advisor bean names. This must always be set
* to use this factory bean in a bean factory.
* <p>The referenced beans should be of type Interceptor, Advisor or Advice
* The last entry in the list can be the name of any bean in the factory.
* If it's neither an Advice nor an Advisor, a new SingletonTargetSource
* is added to wrap it. Such a target bean cannot be used if the "target"
* or "targetSource" or "targetName" property is set, in which case the
* "interceptorNames" array must contain only Advice/Advisor bean names.
* @see org.aopalliance.intercept.MethodInterceptor
* @see org.springframework.aop.Advisor
* @see org.aopalliance.aop.Advice
* @see org.springframework.aop.target.SingletonTargetSource
*/
public void setInterceptorNames(String[] interceptorNames) {
this.interceptorNames = interceptorNames;
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值