1、配置文件没有注册(解决:在核心配置文件中注册mapper,注册有三种形式。资源路径用斜杆,包和类用点)
<mappers>
<!--每一个mapper.xml文件都需要在mybatis核心配置文件中被注册-->
<mapper resource="com/zheng/Dao/UserMapper.xml"></mapper>
</mappers>
2、绑定接口错误(解决:在mapper.xml文件中,namespace是要实现的接口类)
<mapper namespace="com.zheng.Dao.UserMapper">
3、方法名不对(解决:id是接口中对应的方法名)
<select id="selectAllUser" resultType="com.zheng.pojo.User">
select * from mybatis.user
</select>
4、返回类型不对
<select id="selectAllUser" resultType="com.zheng.pojo.User">
select * from mybatis.user
</select>
5、maven导出资源出问题
<!--在build中配置resources,来防止我们资源导出失败的问题-->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
6、时区问题(解决在核心配置文件中)
serverTimezone=Asia/Shanghai"
7、utf-8问题
在核心配置文件和mapper中将utf-8改为utf8