xml配置:
……
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 8; cvc-elt.1: 找不到元素 'beans' 的声明。
……
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<bean id="customerD" class="cn.edu.uestc.dao.CustomerDaoImpl"/>
<bean id="cusromerS" class="cn.edu.uestc.service.CustomerServiceImpl">
<property name="dao">
<ref bean="customerD" />
</property>
</bean>
<bean id="customerC" class="cn.edu.uestc.controller.Customer">
<property name="name">
<value>xiaoming</value>
</property>
<property name="num">
<value>123456</value>
</property>
<property name="service">
<ref bean="cusromerS" />
</property>
</bean>
</beans>
报错:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from class path resource [SpringDemo.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 8; cvc-elt.1: 找不到元素 'beans' 的声明。
……
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 8; cvc-elt.1: 找不到元素 'beans' 的声明。
……
修改:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
......
</beans>