1.Spring
这个问题的原因可能是标签不匹配问题,找了很久的问题才发现beans.xml配置文件中有一个bean元素少了结束标签,以后一定要细心。
异常如下:
Exception in thread "main"
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 71 in XML document from class path resource [beans.xml] is invalid;
nested exception is org.xml.sax.SAXParseException;
lineNumber:71;columnNumber: 47;
cvc-complex-type.2.4.a: 发现了以元素 'bean' 开头的无效内容。
应以
'{"http://www.springframework.org/schema/beans":meta,
"http://www.springframework.org/schema/beans":constructor-arg,
"http://www.springframework.org/schema/beans":property,
"http://www.springframework.org/schema/beans":qualifier,
"http://www.springframework.org/schema/beans":lookup-method,
"http://www.springframework.org/schema/beans":replaced-method,
WC[##other:"http://www.springframework.org/schema/beans"]}' 之一开头。
at ...(省略)
本文介绍了一个关于Spring框架配置文件中Bean元素缺少结束标签所引发的问题及解决办法。作者在排查过程中发现beans.xml文件中存在一个未正确闭合的bean标签,这导致了Spring在解析配置文件时抛出了XmlBeanDefinitionStoreException异常。文章强调了在进行Spring配置时确保XML文件语法正确的重要性。

588

被折叠的 条评论
为什么被折叠?



