springboot訪問數據庫報 Invalid bound statement (not found)

如果在使用mapper.xml時報了Invalid bound statement (not found)的錯誤,並且自己的mapper.xml的路徑和文件名都沒有錯誤的情況,很可能是因爲沒有在pom.xml中配置如下代碼:

<!-- 如果不添加此節點mybatis的mapper.xml文件都會被漏掉。 -->
		<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>

如果不配置resource的話,mapper.xml文件就會讀取不到。

轉自:https://blog.csdn.net/LM891108647/article/details/81437627

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章