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