一.復(fù)現(xiàn)
在我springboot項目,啟動的時候,報了Invalid bound statement (not found) :綁定語句無效(未找到)
二.原因
mapper接口和mapper.xml文件沒有映射起來
三.解決
1.查看mapper.xml中的namespace和接口mapper文件一致嗎
2.看一下 target 里面有沒有編譯的mapper.xml文件
文章來源:http://www.zghlxwxcb.cn/news/detail-621823.html
沒有的話,打開maven點擊clean一下,重新運行就ok了。文章來源地址http://www.zghlxwxcb.cn/news/detail-621823.html
3.檢查pom.xml文件中是否配置resource,不然mapper.xml文件不會被編譯到 target。
<!-- 如果不配置resource,mapper.xml文件不會被加載到target,就會報找不到的錯誤。 -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
到了這里,關(guān)于Invalid bound statement (not found) 原因和解決方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!