<aop:config> <!-- 通过aop定义事务增强切面--> <aop:pointcut id="serviceMethod" expression="execution(* cc.zeelan.app.service..*.*(..))" /> <!--事务增强--> <aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice" /> </aop:config> <!--事务增强 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <!-- 事务属性定义 --> <tx:attributes> <!-- 读取事务 --> <tx:method name="query*" propagation="SUPPORTS" read-only="true" timeout="600"/> <tx:method name="find*" propagation="SUPPORTS" read-only="true" timeout="600"/> <tx:method name="get*" propagation="SUPPORTS" read-only="true" timeout="600"/> <tx:method name="select*" propagation="SUPPORTS" read-only="true" timeout="600"/> <tx:method name="sum*" propagation="SUPPORTS" read-only="true" timeout="600"/> <!-- 操作事务 --> <tx:method name="add*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/> <tx:method name="inse*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/> <tx:method name="del*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/> <tx:method name="update*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/> <tx:method name="edit*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/> <tx:method name="task*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/> </tx:attributes> </tx:advice>