场景

整合MyBatis后运行项目提示:

元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。

MyBatis中提示:元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|de_错误提示

实现

可以肯定的是mapper.xml文件出问题了。

但是仔细对比后发现并没有错误出现。

MyBatis中提示:元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|de_mybatis_02

解决:

按照错误提示的顺序将元素排序,并且删除掉所有的空行以及不和规范的空格等。

如果有黄线标出的警告,要删掉重写一遍。

实在不行就新建mapper文件。

修改之后mapper

MyBatis中提示:元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|de_mybatis_03