报错信息:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 28 in XML document from file [XXX\TestProject\spring-session-test\target\spring-session-test\WEB-INF\classes\config\spring-session.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 9; cvc-complex-type.2.3: Element 'beans' cannot have character [children], because the type's content type is element-only.

原因:

copy过来的文件有特殊字符或编码格式不同。

解决方法:

将文字内容复制到Notepad等编辑器,转为UTF-8编码格式,并用ANSI编码格式查看,将不在注释内的乱码全部删除,再复制进xml即可