<!--配置事务管理器--> <beanid="transactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <propertyname="sessionFactory"> <refbean="mySessionFactory"/> </property> </bean> |
<!--配置事务传播特性--> <tx:adviceid="TestAdvice"transaction-manager="transactionManager"> <tx:attributes> <tx:methodname="save*"propagation="REQUIRED"/> <tx:methodname="del*"propagation="REQUIRED"/> <tx:methodname="update*"propagation="REQUIRED"/> <tx:methodname="add*"propagation="REQUIRED"/> <tx:methodname="find*"propagation="REQUIRED"/> <tx:methodname="get*"propagation="REQUIRED"/> <tx:methodname="apply*"propagation="REQUIRED"/> </tx:attributes> </tx:advice> <!--配置参与事务的类--> <aop:config> <aop:pointcutid="allTestServiceMethod"expression="execution(*com.test.testAda.test.model.service.*.*(..))"/> <aop:advisorpointcut-ref="allTestServiceMethod"advice-ref="TestAdvice"/> </aop:config> |
原文:http://www.blogjava.net/qileilove/archive/2014/10/30/419243.html