【发布时间】:2011-11-29 00:04:17
【问题描述】:
我们如何在spring中使用条件连接点
在我的要求中,如果 方法名称是 insert 或方法名称是 update 或方法名称是 delete 并且该方法应该有三个参数,则必须应用切入点
这是我写的代码,
<aop:config>
<aop:aspect ref="auditAOP">
<aop:pointcut id="insert" expression="execution(* .IbatisDAOSupportImpl.insert(*,*,*))" />
<aop:pointcut id="delete" expression="execution(* IbatisDAOSupportImpl.delete(*,*,*))" />
<aop:pointcut id="update" expression="execution(* IbatisDAOSupportImpl.update(*,*,*))" />
<aop:pointcut id="auditInsertUpdateOrDelete" expression="insert || delete || update"/>
<aop:after method="afterInsertUpdateOrDelete" pointcut-ref="auditInsertUpdateOrDelete"/>
</aop:aspect>
</aop:config>
下面这行有问题;我收到一个错误,说表达式格式不正确。
<aop:pointcut id="auditInsertUpdateOrDelete" expression="insert || delete || update"/>
【问题讨论】:
标签: java spring aop pointcuts aspect