org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 异常

记录一下学习spring中出现的错误。

 看到那么多红一定不要害怕,勇敢面对,这样才能进步!

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

 由红色错误提示可以得出是context:component-scan 组件扫描中出现了错误

 错误其实很简单,就是我在beans命名空间中引入context的时候写成了contetxt。如果又发生类似错误的小伙伴们,请仔细检查自己beans的命名空间!

源码:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       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" >

 改正过来就ok了!

猜你喜欢

转载自blog.csdn.net/weixin_63003502/article/details/127450871
今日推荐