Spring事务配置


<!-- 配置扫描器 --> <context:component-scan base-package="com.lv.jee.spring.comment"> </context:component-scan> <!-- 配置数据库相关-事务 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url" value="jdbc:mysql://localhost:3306/test"></property> <property name="username" value="root"></property> <property name="password" value="root"></property> <property name="maxActive" value="10"></property> <property name="maxIdle" value="6"></property> </bean> <!-- 配置事务管理器txManager --> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <!-- 增加对事务的支持 --> <tx:annotation-driven transaction-manager="txManager"/>

 

posted @ 2019-04-06 16:40  B-binary  阅读(110)  评论(0编辑  收藏  举报