高手帮忙,spring中xml配置文件出错~
我在xml配置文件中设置了<beanid="some1"class="org.springframework.beans.factory.config.Propertie...
我在xml配置文件中设置了
<bean id="some1" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<props>
<prop key="key1">go!go!</prop>
<prop key="key2">wa~wa~</prop>
</props>
</bean>
但是程序运行显示<props>出错,出错如下,这是为什么,谢谢回答~
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from class path resource [beans-config2(1).xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'props'. One of '{"http://www.springframework.org/schema/beans":description, "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":lookup-method, "http://www.springframework.org/schema/beans":replaced-method, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected. 展开
<bean id="some1" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<props>
<prop key="key1">go!go!</prop>
<prop key="key2">wa~wa~</prop>
</props>
</bean>
但是程序运行显示<props>出错,出错如下,这是为什么,谢谢回答~
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from class path resource [beans-config2(1).xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'props'. One of '{"http://www.springframework.org/schema/beans":description, "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":lookup-method, "http://www.springframework.org/schema/beans":replaced-method, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected. 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询