對mybatis不是很熟,最近寫接口的時候,一直報Mapped Statements collection does not contain value for異常,最後發現是接口調用的xml裏沒有所寫方法,方法寫到了弄一個備份文件裏面了。
錯誤原因有幾種:
1、mapper.xml中沒有加入namespace2、mapper.xml中的方法和接口mapper的方法不對應
3、mapper.xml沒有加入到mybatis-config.xml中(即總的配置文件),例外:配置了mapper文件的包路徑的除外
4、mapper.xml文件名和所寫的mapper名稱不相同。
see:http://blog.csdn.net/wang623145708/article/details/27213685