mybatis找不到映射配置文件的原因和解决。

target中没有导入***Mapper.xml,由于maven的约定大于配置属性,这里的配置文件无法被导出或生效。
解决方法:在pom.xml文件中添加如下代码块

  <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>

 

posted @ 2022-08-07 01:10  xiaoyongdata  阅读(755)  评论(0编辑  收藏  举报