org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from c

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from class path resource [Application.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 63; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘context:component-scan’ 的声明。

当要实现注解扫描的时候

出现这种问题是xsi:schemaLocation没有让你导入的命名空间找到对应的URI地址
在这里插入图片描述
如上图所示,导入context命名空间,但是在xsi种没有使context命名空间找到它对应的Schema文件,只需要将其填上即可,一般都是两个Url地址中间隔的一个空格,来表示第一个为命名空间的url,第二个为其对应的schema文件(xsd文件)地址。

它定义了XML Namespace和对应的XSD(Xml Schema Definition)文档的位置的关系。它的值由一个或多个URI引用对组成,两个URI之间以空白符分隔(空格和换行均可)。第一个URI是定义的XML Namespace的值,第二个URI给出Schema文档的位置,Schema处理器将从这个位置读取Schema文档,该文档的targetNamespace必须与第一个URI相匹配。

在这里插入图片描述

对于命名空间有些不理解的,可以看下面这篇文章
xsi:schemaLocation有何作用