cvc-elt.1: 找不到元素 'beans' 的声明

lys2017年12月11日 0条评论

百度了好多大神写的博文都没解决

最后还是自己解决了,不废话直接列出内容,给大家参考

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
    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    
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
	
	<context:component-scan base-package="com.dao" />  <!-- 使用注解形式的bean,扫描注解 -->

</beans>


看下是不是 漏了最后 

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

或者是

http://www.springframework.org/schema/beans/spring-beans.xsd

有差异