1. 程式人生 > >Maven專案mybatis Invalid bound statement (not found)解決方法

Maven專案mybatis Invalid bound statement (not found)解決方法

最近因為工作需要,要學習mybatis框架。在新增好一些依賴之後,通過mybatis進行資料庫的crud操作。但是在測試的時候總是報mybatis:Invalid bound statement (not found)。在網上搜索了好久,最後終於發現了問題的所在,現在把它記錄下來,供大家參考:

在mapper代理的開發中,程式設計師需要遵守一些規範,mybatis才能實現mapper介面的代理物件。
它的規範如下:

  • mapper.xml的namespace要寫所對映介面的全稱類名。
  • mapper.xml中的每個statement的id要和介面方法的方法名相同
  • mapper.xml中定義的每個sql的parameterType要和介面方法的形參型別相同
  • mapper.xml中定義的每個sql的resultType要和介面方法的返回值的型別相同
  • mapper.xml要和對應的mapper介面在同一個包下
  • mapper.xml的命名規範遵守: 介面名+Mapper.xml

如果以上檢查完畢,專案都遵守了上述的規範,而且你的專案是Maven專案。但是執行程式還是會出現Mybatis invalid bound statement(not found)的問題,這個時候就需要修改pom.xml檔案了。在pom.xml中新增如下的程式碼:

    <build>    
        <resources>
            <
resource>
<directory>src/main/java</directory> <!-- 此配置不可缺,否則mybatis的Mapper.xml將會丟失 --> <includes> <include>**/*.xml</include> </includes> </resource> <!--指定資源的位置-->
<resource> <directory>src/main/resources</directory> </resource> </resources> </build>

將以上程式碼新增到pom.xml中,執行專案,問題解決。

相關推薦

Maven專案mybatis Invalid bound statement (not found)解決方法

最近因為工作需要,要學習mybatis框架。在新增好一些依賴之後,通過mybatis進行資料庫的crud操作。但是在測試的時候總是報mybatis:Invalid bound statement (not found)。在網上搜索了好久,最後終於發現了問題的所在,現在把它記錄下來,供大家參考: 在mappe

eclipse裡報org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解決方法

思路分為:從報的  org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)異常可以看出是  dao

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解決方法

最近在跑一個springboot+mybatis的程式時,idea報出了這樣的錯誤 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.marsh.dao.

[Mybatis] Invalid bound statement (not found): com.xxx.dao.UserInfoMapper.insertSelective

Invalid bound statement (not found): com.example.core.common.dao.UserInfoMapper.insertSelective mybatis 整合spring-boot、postgresql時發生,主要原因是g

IDEA+Maven+Springboot:invalid bound statement (not found) 解決辦法

自己使用Springboot搭建web專案,之前都是使用註解形式來執行sql獲取查詢內容,這次本承著閒得無聊試一試的想法,突發奇想想用xml的方式執行sql。很走心的參照自己之前spring專案的書寫格式,順便百度了也就幾十個springboot搭建的問題,終於把xml的相關配置弄好。天知道,g

IDEA+Maven:invalid bound statement (not found)解決辦法

IDEA+Maven的SSM專案,遇到一個深坑invalid bound statement (not found),就是mapper檔案掃描不到! 各種除錯,各種找Bug,網上大多數人說是mapper配置檔案路徑問題,但我的沒錯啊,最後才發現這種說法: 原來是需要在

spring boot mybatis Invalid bound statement (not found)

問題描述: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.idark.modules.user.service.UserServic

mybatis invalid bound statement (not found) 當心檔案確實不存在

前言:本人在將不適用maven的專案轉化為maven專案後,遇到了 invalid bound statement (not found),百思不得其解,因為此前是可以執行的,而轉為maven專案後,可以正常執行maven clean install 命令打包釋出。但是訪問

invalid bound statement (not found)解決辦法 (掃描路徑是正確的)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.

異常 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 解決方案

    原來是因為 AssetsMapper.xml 不知道為什麼不見了,導致這個異常,在啟動專案時的啟動任務裡呼叫到了它,然後因為沒有這個xml,所以丟擲異常   啟動資訊: C:\extend\Development\apache-tomcat-7.0.84\

invalid bound statement (not found)解決辦法

最近搭建一個web專案後端SSM框架練手,使用Maven管理,遇到一個深坑invalid bound statement (not found),就是mapper檔案掃描不到!!! 先上整合過程,解決辦法最後上。 1、專案結構: 2、pom檔案: <project xml

maven 專案mybatis報錯org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

maven管理的spring專案在打包install啟動後,mybatis報錯org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): … 錯誤描述: 專案使用mybat

maven專案下報錯mybatis org.apache.ibatis.binding.BindingException: Invalid bound statement(not found)

maven專案下報錯mybatis org.apache.ibatis.binding.BindingException: Invalid bound statement(not found 問題原因 解決辦法 其它原因

maven搭建web專案中org.apache.ibatis.binding.BindingException:Invalid bound statement ( not found)

最近使用Maven配合SSM(Spring+SpringMVC+Mybatis)搭建一個Web專案,在測試三個框架是否整合成功的時候,每次發出請求呼叫MyBatis時都會出現下面這個錯誤 從異常資訊的提示來看是一個無效的語句繫結錯誤,一般出現該錯誤是由於MyBatis的Map

Maven 遇到mybatis 發生org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

最近在做一個專案用到了spring+springMVC+mybatis+maven 的專案。第一次接觸到maven構建和使用idea。遇到了一個問題,說實話自己被這個問題困住了好久。網上查了好久,也沒有找到。好了,貼一下錯誤。 org.apache.ibati

【spring boot Mybatis】報錯:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.newhope.interview.dao.UserMapper.add

使用 ase err abstract internal tin mic pre uestc 報錯如下: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): c

在使用mybatis的selectFromExample時出現Invalid bound statement (not found)錯誤

oca ror jdk filter tro lec ces hint nco 主要原因:運行項目在構建的時候只會默認的去加載resource資源文件裏面的資源,其他地方的配置資源不會加載 。故沒有讀取到mybatis的MapperXml映射 結構如下 =======

【ide】MyBatis報錯: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

align basedir schedule ima reflect oda apache ref mapper at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.j

myBatis的binding錯誤:Invalid bound statement (not found)

per HERE state gui bean ESS dao 錯誤 java org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)錯誤這個問題我找了好久,終於找到了正

MyBatis使用動態代理報 invalid bound statement (not found) 錯

ali col ati mapper 文件中 tis bound inter 一個 這個問題網上大部分都說xml文件中的路徑不對 或者是resources之類的問題,如果那些文章的解決方案解決不了你的問題的話,可以看一下我遇到的這種情況: Mapper Interface