在初学Mybatis程序遇到的问题
idea报错: Could not find resource com/xxx/xxxMapper.xml
解决办法:
1核心配置文件.xml文件中插入
<mappers>
<mapper resource="com/Study/dao/UserDao.xml"></mapper>
</mappers>
2.在pom.xml中插入
<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>
3.但是我出现的问题,以上方法都没有用,最后在我舍友的帮助下解决的问题
<property name="driver" value="com.mysql.jdbc.Driver"/>
改为:
<property name="driver" value="com.mysql.cj.jdbc.Driver"/>
还有不要忘记时区设置:
serverTimezone=UTC
4.这些都改完以后,最后得到的居然是
解决方法是在实体类中重写ToString方法。

浙公网安备 33010602011771号