1、
<context:component-scan base-package="com.mmall" annotation-config="true"/>
总是说扫描 不到"com.mmall”这个包,找了很多原因,原来一开始就错了,main下的java包要设置成resources root
2、
[21:23:19.092][DEBUG][org.mybatis.spring.SqlSessionUtils][http-bio-8088-exec-10] Creating a new SqlSession
[21:23:19.092][DEBUG][org.mybatis.spring.SqlSessionUtils][http-bio-8088-exec-10] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@27aedc67] was not registered for synchronization because synchronization is not active
[21:23:19.093][DEBUG][o.m.s.t.SpringManagedTransaction][http-bio-8088-exec-10] JDBC Connection [jdbc:mysql://localhost:3306/mmall_learning?characterEncoding=utf8, UserName=root@localhost, MySQL-AB JDBC Driver] will not be managed by Spring
[21:23:19.093][DEBUG][com.mmall.dao.UserMapper.checkUsername][http-bio-8088-exec-10] ==> Preparing: select count(1) from mmall_user where username=?
[21:23:19.093][DEBUG][com.mmall.dao.UserMapper.checkUsername][http-bio-8088-exec-10] ==> Parameters: null
[21:23:19.093][DEBUG][com.mmall.dao.UserMapper.checkUsername][http-bio-8088-exec-10] <== Total: 1
[21:23:19.094][DEBUG][org.mybatis.spring.SqlSessionUtils][http-bio-8088-exec-10] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@27aedc67]
3、org.springframework.jdbc.support.SQLErrorCodesFactory <init>
使用spring+mybatis整合时报错:org.springframework.jdbc.support.SQLErrorCodesFactory - SQLErrorCodes loaded
错误原因是;
1.参数与数据库字段不匹配,可能是映射文件sql语句写错了,字段名与数据库中的字段名不匹配。
2.也有可能是传递的参数超过了数据库字段限定的长度。
3.也有可能是resultMap映射字段不对。