spring--事务(Transaction)

导包
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"

<!--配置事务管理器-->
<bean id="dataSourceTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"></property>
</bean>

<!--启用事务注解-->
<tx:annotation-driven transaction-manager="dataSourceTransactionManager"/>

方法添加注解

猜你喜欢

转载自blog.csdn.net/panruola/article/details/86747507