标签:
一、添加cglib.jar
二、spring.xml中加入如下配置
<!-- 事务管理器 -->
<bean id="txManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<!-- <property name="dataSource" ref="myDataSource"></property> -->
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<aop:config proxy-target-class="true">
<aop:pointcut expression="execution(* com.arhat.service.impl.*.*(..))"
id="txCut" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="txCut" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager">
<!-- 事务的传播属性 -->
<tx:attributes>
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
<tx:method name="save*" propagation="REQUIRED"></tx:method>
<tx:method name="update*" propagation="REQUIRED"></tx:method>
<tx:method name="delete*" propagation="REQUIRED"></tx:method>
</tx:attributes>
</tx:advice>
标签:
原文地址:http://www.cnblogs.com/cuiqingyu001/p/4455849.html