org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException


在配置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文檔的表頭上

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM