Spring 之注解事务 @Transactional
来源:互联网 发布:asp源码 编辑:程序博客网 时间:2024/06/07 14:51
1.定义一个数据源
<beanid="comboPooledDataSource"class="com.mchange.v2.c3p0.ComboPooledDataSource">
<propertyvalue="${jdbc.driverClass}"name="driverClass"/>
<propertyvalue="${jdbc.url}"name="jdbcUrl"/>
<propertyvalue="${jdbc.username}"name="user"/>
<propertyvalue="${jdbc.password}"name="password"/>
</bean>
2.定义jdbc的jdbcTemplate
<beanid="jdbcTemplate"class="org.springframework.jdbc.core.JdbcTemplate">
<propertyname="dataSource"ref="comboPooledDataSource"></property>
</bean>
3.配置事物管理器
<beanname="transactionManager"class="DataSourceTransactionManager">
<propertyname="dataSource"ref="comboPooledDataSource"></property>
</bean
4.开启事物
<!-- 开启注解事物管理 替代了xml里面的切面和通知-->
<tx:annotation-driventransaction-manager="transactionManager"/>
5.在该Bean的代码中标注@Transactional
service层 逻辑处理层 也就是真正实现方法层
阅读全文
0 0
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务@Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Spring 之注解事务 @Transactional
- Android控件-ScrollView 和WebView之见滑动冲突解决
- MVC框架
- JAVA程序打印九九乘法表
- 性能优化的思路和步骤
- C++面试之GetMemory问题
- Spring 之注解事务 @Transactional
- 木马开机启动的六种方法
- 终于弄明白了Eclipse中Maven和SVN,真不容易!
- shadowsocks服务器搭建
- Spring在web开发中的应用
- less命令压缩成css
- 拓扑排序【Template】
- 版本锁定 dependencyManagement与<dependencies> 的区别
- Python学习之路---Python模块