自己写了一个aop
想被包含在 事务中,刚开始以为 order越小越先执行,发现不是,我这里用的around的,需要事务嵌套在外面。
实际是,order越小,越在外围
<!-- order 的值越小,越在外围-->
<tx:annotation-driven transaction-manager="txManager" order="1" />
<aop:config >
<!-- 添加流程保存的切面方法 -->
<aop:pointcut expression="execution(* *..*ServiceImpl.save(..))||execution(* *..SZ*ServiceImpl.save(..))" id="flowSavePoint"/>
<!-- order 的值越小,越在外围-->
<aop:aspect ref="flowSaveAspect" order="2">
<aop:around method="aroundMethod" pointcut-ref="flowSavePoint"/>
</aop:aspect>
</aop:config>
<!-- 自动为spring容器中那些配置@aspectJ切面的bean创建代理,织入切面 -->
<aop:aspectj-autoproxy />
<!-- 使用annotation自动注入bean,并启动相关处理注解的进程 -->
<context:component-scan base-package="com.xxxx">
</context:component-scan>
参考url:http://www.iteye.com/topic/1047080