在配置spring的application.xml文件的时候,出现了这个bug

  spring装配容器失败:

  org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

有两种错误:

  第一种:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 
Line 1 in XML document from class path resource [spring/application.xml] is invalid;
nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7;
不允许有匹配 "[xX][mM][lL]" 的处理指令目标。

  注意:xml文件的表头的第一句,一定是<?xml version="1.0" encoding="UTF-8"?>。

    其前面不能有“空格”。一定是顶格的第一行。

  第二种:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
nested exception is og.xml.sax.SAXParseException;
lineNumber: 12; columnNumber: 47; cvc-elt.1: 找不到元素 'beans'

  注意:是beans的命名空间有错误,注意导入的约束的命名一定要规范。

    可以根据自己导入的jar包,去官网把对应的约束复制粘贴到xml文档的表头上

 

12-27 18:45
查看更多