Mybatis中Mapper.xml文件中注释存在中文报错问题

不操千曲而后晓声,观千剑而后识器。这篇文章主要讲述Mybatis中Mapper.xml文件中注释存在中文报错问题相关的知识,希望能为你提供帮助。
在Mapper.xml中注释中文时,编译会报如下错误

Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字节的 UTF-8 序列的字节 2 无效。 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:702) at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:373) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1895) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1389) at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:801) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1036) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2984) ... 16 more

【Mybatis中Mapper.xml文件中注释存在中文报错问题】将xml的文件头encoding="UTF-8"改为encoding="UTF8"后问题解决

    推荐阅读