Spring头文件

问题:Spring启动时报错,错误内容是"Caused by: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 56; cvc-elt.1: 找不到元素 'bean' 的声明。"根据提示,分析问题应该是找不到beans,根源是配置文件出错。

解决方法:在bean.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"

xmlns:context="http://www.springframework.org/schema/context"

xmlns:tx="http://www.springframework.org/schema/tx"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd

http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

 

.......

</beans>

 

 

你可能感兴趣的:(spring)