java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for

异常的出现

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.xxxx.order.dao.task.OrderMapper.findAddressOrderBlackList
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.xxxx.order.dao.task.OrderMapper.findAddressOrderBlackList

原因

MappedStatement集合里面不包含这个方法,MyBatis会根据xml文件生成MappedStatement放到Configuretion中,如果找不到,有可能是对应的xml找不到,或者xml中没有id为findAddressOrderBlackList语句。

探索

报错
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for_第1张图片
dao
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for_第2张图片
从Configuration中获得MappedStatement
异常就是从get方法抛出的
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for_第3张图片
果然就是这里

sch:在很久之前页遇到过同样的问题,原因是xml文件的namespace不对,也导致从MappedStatement的集合中查询不到。最近在阅读MyBatis源码,所以一看就知道是什么原因导致的了。
上次的链接:
http://www.jianshu.com/p/322a2c897352

你可能感兴趣的:(java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for)