org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.analyst.mapp...

若是出現:java

  org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)apache

通常的緣由是Mapper interface和xml文件的定義對應不上,須要檢查包名,namespace,函數名稱等可否對應上。mybatis

按如下步驟一一執行:app

一、檢查xml文件所在的package名稱是否和interface對應的package名稱一一對應函數

二、檢查xml文件的namespace是否和xml文件的package名稱一一對應spa

三、檢查函數名稱可否對應上code

四、去掉xml文件中的中文註釋xml

五、隨意在xml文件中加一個空格或者空行而後保存blog

注意:在使用IDEA開發時,若是打包時*Mapper.xml沒有自動複製到class輸出目錄的mapper類包下,則須要在pom文件中添加mybatis加載配置文件的配置!開發

<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>


相關文章
相關標籤/搜索