Maven建立SSM專案 啟動時報錯Mapped Statements collection does not contain value for xxx

超哥CG_544發表於2020-12-05

問題:Maven建立SSM專案 啟動時報錯Mapped Statements collection does not contain value for xxx
經過檢查發現Mapper.xml名稱空間沒寫錯,註解沒有少,自動掃描包也正常,但是仍然報錯
解決方案:Maven中需要新增resource標籤,resources標籤中指定對映檔案路徑,否則xml對映檔案以及資原始檔不會被Maven載入!
貼程式碼:

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

問題成功解決,希望本篇文章可以幫助到需要的人哈,轉載註明出處!

相關文章