这是上篇文章提到的action层插入切点 ,然后再切点处调用自身,获取数据的一个方法。。。有点讨巧,也有点脑洞大开的意思~
applicationContext.xml
<!-- 配置spring aop切面Bean -->
<bean id="check" class="com.njbh.fault.Check"/>
<aop:config>
<aop:aspect id="myAop1" ref="check">
<aop:pointcut expression="execution(* com.njbh.fault.action.FaultInfoAction.batchClearUp*(..))" id="deleteicon"/>
<aop:before method="checkValidity" pointcut-ref="deleteicon"/>
<aop:after method="decreaseLog" pointcut-ref="deleteicon"/>
</aop:aspect>
</aop:config>
FaultInfoAction
public int batchClearUp(List idList ){
FaultInfoService faultInfoService = (FaultInfoService)service;
int count = faultInfoService.batchClearUp(idList);
return count;
}
pulic XX f(){
FaultInfoAction self = (FaultInfoAction)SpringUtil.getObject("faultInfoAction");
count = self.batchClearUp(idList );
}
上面就是在切点处调用自身方法的一个写法,亲测有效~