cvc-elt.1: Cannot find the declaration of element 'beans'.

context.xml文件报错

Multiple annotations found at this line:
	- cvc-elt.1: Cannot find the declaration of element 'beans'.
	- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-3.0.xsd', because 1) could not find the document; 2) the document could 
	 not be read; 3) the root element of the document is not <xsd:schema>.

我的beans配置是这样的

<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-3.0.xsd">

可能是spring版本不对导致的

我看了一下使用的是spriing4.x版本

所有修改了版本为spring-beans-4.0即可

<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-4.0.xsd">
发布了64 篇原创文章 · 获赞 34 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/svygh123/article/details/103854126