您的位置:首页 > 编程语言 > Java开发

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

2017-02-23 16:35 956 查看
在搭建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"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐