mybatis 报Invalid bound statement(not found) 和 Property 'mapperLocations' was not specified or not matching resources found


排除问题的步骤:

1.首先检查mapper文件和mapper接口的文件名是否相等。

2.pom.xml是否把xml排除了,这样写就会src/main/java下所有的Mybatis的xml文件都删除,也就是在target包下没有任何xml文件。

<resources>

  <directory>src/main/java</directory>

     <excludes>

    <exclude>**/*.xml</exclude>
    </excludes>

</resources>

 

正确的的是如下所示:

 

 

<resources>

  <directory>src/main/java</directory>

     <includes>

    <include>**/*.xml</include>
    </includes>

</resources>

 

 

3.看看配置文件中的:

mybatis.mapperLocations="mapper xml 扫描的路径"  如果扫描不到就会报Invalid bound statement(not found)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM