在类com.ipharmacare.plat.service.data.DocOrgService中定义了如下2个方法:
spring aop配置如下:
在DocManageAction中调用了方法DocOrgService.operate(DocManageVo doc, String[] allOrgs, String productId, String entCode),[color=red]发现AOP中的逻辑并没执行[/color],这有点奇怪了!?
无意间我在DocManageAction中调用方法DocOrgService.operate(Integer docId, String[] allOrgs, DocManageVo doc),[color=blue]发现AOP中逻辑已成功执行[/color]!
这就有点不明白了,何以在DocOrgService本类中调用operate(Integer docId, String[] allOrgs, DocManageVo doc)方法,其AOP逻辑为何不生效呢,而必须在其它类中调用该方法其AOP逻辑才生效!?
public int operate(Integer docId, String[] allOrgs, DocManageVo doc) {
int r = 0;
...
return r;
}
public int operate(DocManageVo doc, String[] allOrgs, String productId, String entCode) {
int r = 0;
...
r += operate(doc.getId(), allOrgs, doc);
return r;
}
spring aop配置如下:
<aop:aspect id="aspect.deliveryChangeLog.aop" ref="deliveryChangeLogAop">
<aop:pointcut
expression="execution(int com.ipharmacare.plat.service.data.DocOrgService.operate(Integer,..))"
id="pointcut.deliveryChangeLog" />
<aop:around method="around" pointcut-ref="pointcut.deliveryChangeLog" />
<aop:after method="after" pointcut-ref="pointcut.deliveryChangeLog" />
</aop:aspect>
在DocManageAction中调用了方法DocOrgService.operate(DocManageVo doc, String[] allOrgs, String productId, String entCode),[color=red]发现AOP中的逻辑并没执行[/color],这有点奇怪了!?
无意间我在DocManageAction中调用方法DocOrgService.operate(Integer docId, String[] allOrgs, DocManageVo doc),[color=blue]发现AOP中逻辑已成功执行[/color]!
这就有点不明白了,何以在DocOrgService本类中调用operate(Integer docId, String[] allOrgs, DocManageVo doc)方法,其AOP逻辑为何不生效呢,而必须在其它类中调用该方法其AOP逻辑才生效!?