<bean id="transactionManager" class="org.springframework.jdbc.dataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
xml方式
<tx:advice id="myAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="pay*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advicer advice-ref="myAdvice" pointcut="execution(* *..*.*(..))"/>
</aop:config>
注解方式
<tx:annotation-driven transation-manager="transactionManager"/>
在要加事务的serviceimpl上加
@Transactional
网友评论