在初學Mybatis程式遇到的問題 Could not find resource com/xxx/xxxMapper.xml
阿新 • • 發佈:2022-04-02
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方法。