【发布时间】:2021-03-07 00:34:34
【问题描述】:
我正在尝试将 struts2 与 spring 集成,但我 收到这样的错误消息。
2020-11-24 16:23:21,624 错误 [main] context.ContextLoader (ContextLoader.java:313) - 上下文初始化失败 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:来自 ServletContext 资源 [/WEB-INF/applicationContext.xml] 的 XML 文档中的第 8 行无效;嵌套异常是 org.xml.sax.SAXParseException;行号:8;列号:68;必须为元素类型“beans”声明属性“xmlns”。
我的 applicationContext.xml 有什么问题?
这是我的设置。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="helloWorldClass" class="org.mentha.example.HelloWorld" >
<property name="message" value="Hello World! from arpit" />
</bean>
</beans>
【问题讨论】:
-
使用spring框架解析xml配置文件的时候应该澄清一下你的问题。
标签: xml spring xml-namespaces xml-configuration