通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明

简介: 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明

在学习Dubbo中遇到了这个问题


org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 12 in XML document from URL [file:/F:/workspace/spring/target/classes/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 55; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。


这个问题其实特别简单,就是在xml的配置文件中,只引入了context命名空间,但并没有引入schemaLocation


如下标红所示,引入即可

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
           xmlns="http://www.springframework.org/schema/beans"
           xmlns:context="http://www.springframework.org/schema/context"
           xsi:schemaLocation="http://www.springframework.org/schema/beans                  http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
       http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-4.0.xsd">
相关文章
|
1月前
|
XML 应用服务中间件 Apache
通配符的匹配很全面, 但无法找到元素 ‘context:component-scan‘ 的声明。
通配符的匹配很全面, 但无法找到元素 ‘context:component-scan‘ 的声明。
|
1月前
|
人工智能
D. Remove One Element(前缀最大+简单状态机)
D. Remove One Element(前缀最大+简单状态机)
|
8月前
解决cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘context:property-placeholder‘ 的声明的问题~
解决cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘context:property-placeholder‘ 的声明的问题~
120 0
|
1月前
|
前端开发
selenium 解决 id定位、class定位中,属性值带空格的解决办法
selenium 解决 id定位、class定位中,属性值带空格的解决办法
113 1
|
1月前
|
Java 索引
正则表达式源码分析--三个常用类--分组、捕获、反向引用--String 类中使用正则表达式的代码示例和图
正则表达式源码分析--三个常用类--分组、捕获、反向引用--String 类中使用正则表达式的代码示例和图
53 0
|
8月前
|
XML 数据格式
解决问题:通配符的匹配很全面, 但无法找到元素 ‘context:component-scan‘ 的声明~
解决问题:通配符的匹配很全面, 但无法找到元素 ‘context:component-scan‘ 的声明~
105 1
|
XML 数据格式
通配符的匹配很全面, 但无法找到元素 ‘tx:advice‘ 的声明
通配符的匹配很全面, 但无法找到元素 ‘tx:advice‘ 的声明
111 0
struts2中Action名称的搜索顺序
struts2中Action名称的搜索顺序
62 0
|
Android开发
Eclipse出现:元素 'beans' 必须不含字符 [子级], 因为该类型的内容类型为“仅元素”....解决办法
Eclipse出现:元素 'beans' 必须不含字符 [子级], 因为该类型的内容类型为“仅元素”....解决办法
203 0
|
前端开发
1、CSS选择器(通配符,标签,类,id)
1、CSS选择器(通配符,标签,类,id)
153 0