DeBug笔记

DeBug笔记

  • 1.Spring
  • 2.MyBatis
    • 2.1MyBatis配置错误
      • 2.1.1 UTF-8错误
      • 2.1.2 mybatis-config.xml找不到错误

1.Spring

2.MyBatis

2.1MyBatis配置错误

2.1.1 UTF-8错误

Exception in thread “main”
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 36 in XML document from class path resource [spring-cfg4.xml] is
invalid; nested exception is org.xml.sax.SAXParseException;
lineNumber: 36; columnNumber: 11; 2 字节的 UTF-8 序列的字节 2 无效。
报错如上,原因是
DeBug笔记_第1张图片
将UTF-8写成UTF8
或者在pom.xml中进行一项配置
DeBug笔记_第2张图片
UTF-8

2.1.2 mybatis-config.xml找不到错误

Exception in thread “main” org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring-cfg4.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring-cfg4.xml] cannot be opened because it does not exist
如果你的mybatis-config.xml没有放在resources文件夹下,那么在编译的时候,不会将xml和properties文件编译进去。
DeBug笔记_第3张图片
在pom.xml中进行配置
DeBug笔记_第4张图片
src/main/java **/*.properties **/*.xml true

你可能感兴趣的:(Algorithm,spring,java,intellij-idea)