最近重新使用mybatis,好多错误忘记了,记录下典型错误:
Mapped Statements collection does not contain value for后面是什么类什么方法之类的:
错误原因有几种:1、mapper.xml中没有加入namespace
2、mapper.xml中的方法和接口mapper的方法不对应
3、mapper.xml没有加入到mybatis-config.xml中(即总的配置文件),例外:配置了mapper文件的包路径的除外
4、mapper.xml文件名和所写的mapper名称不相同。
5、mapper.xml中有有转义字符,需要用<![CDATA[ ]]>包装起来
Error creating bean with name
一般情况是mapper.xml中有有转义字符,需要用<![CDATA[ ]]>包装起来,但是因为使用spring,将文件import进去最终报测错误比较难懂