spring框架DAO搭配注解配置时注意事项
来源:互联网 发布:js获取指定父节点 编辑:程序博客网 时间:2024/04/30 01:30
如果报错:
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread
1、注意先后顺序
context:annotation-config/>
<context:component-scan base-package=""/>
<tx:annotation-driven />
2、注意base-package的扫描要独立分开,不要全路径的扫描。 service部分
<context:annotation-config/>
<context:component-scan base-package="com.saper.tutorial.service"/>
<context:component-scan base-package="com.saper.tutorial.dao"/>
<tx:annotation-driven transaction-manager="transactionManager"/>
controller部分
<context:component-scan base-package="com.saper.tutorial.controller"/>
红色部分不能简写成如下:
<context:component-scan base-package="com.saper.tutorial"/>
红色部分不能简写成如下:
<context:component-scan base-package="com.saper.tutorial"/>
0 0
- spring框架DAO搭配注解配置时注意事项
- java 框架基础知识(5)----注解-->Spring配置
- Spring框架 基于注解配置(四)
- Spring框架 AspectJ注解配置(四)
- spring框架基于注解的容器配置
- 深入理解事务--Spring注解式事务配置注意事项
- 深入理解事务--Spring注解式事务配置注意事项
- spring与jdbc配置搭配
- spring-dao配置
- spring-dao配置
- struts2注解配置注意事项
- struts2注解配置注意事项
- 解决Spring框架的Dao层改用@Repository注解,无法使用JdbcDaoSupport的问题
- 【Spring】在Spring框架下使用注解配置JDBC事务
- 搭建jetty spring 框架 配置spring 注解 <二>
- spring一站式框架(dao层)
- spring注解配置整合的jdbc和hibernate的dao实现类
- Spring通过XML配置c3p0连接池和dao层注解注入使用 jdbcTemplate
- SSH框架项目实战视频教程——校内网项目韩顺平
- CentOS -bash: ./xxx/make: No such file or directory
- POJ 1323 Game Prediction
- 中国十大电商网站优势与劣势分析
- Project Tungsten:让Spark将硬件性能压榨到极限
- spring框架DAO搭配注解配置时注意事项
- java读取文件的几种方式
- 远程连接服务器For Windows 2003 & 2008
- 狼性周鸿祎:半是商人,半是将军
- PHP极速入门教程
- 性能优化系列总篇
- Android中XML文件的三种解析方式
- 解决eclipse中maven项目编译失败的问题
- POJ 3321 Apple Tree 树状数组