[size=medium]ProxyFactoryBean 代理工厂的属性 interceptorNames的值的范围 例子如下:[/size]
[size=medium]interceptorNames 属性的list集合里面只能放 通知/通知者 。
通知/通知者被称为拦截者(拦截器)。
spring in action 翻译的书里面说集合成员是拦截者/通知者 这是错误的。概念不清晰,希望大家注意一下。
以下是源码里面的解释如下:[/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;
}