通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。--问题的原因及解决方案

来源:互联网 发布:windows确认证书 编辑:程序博客网 时间:2024/06/07 20:21

在搭建Spring框架时,在applicationContext.xml文件中写自动扫描的配置时,报出异常。

原因:<beans>标签的文件头未写完整,特别是xsd文件。

给出一个范例:

<beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns:aop="http://www.springframework.org/schema/aop"       xmlns:context="http://www.springframework.org/schema/context"       xsi:schemaLocation="http://www.springframework.org/schema/context            http://www.springframework.org/schema/context/spring-context.xsd            http://www.springframework.org/schema/beans            http://www.springframework.org/schema/beans/spring-beans.xsd            http://www.springframework.org/schema/aop            http://www.springframework.org/schema/aop/spring-aop.xsd">    <context:component-scan base-package="com.yykj.soundsystem"/>

0 0
原创粉丝点击