在初学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方法。

 

posted @   一一以以  阅读(30)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示