关于spring配置时遇到”通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明”

本文详细解析了一个初学者在XML配置中可能遇到的典型错误——因URL拼写错误导致的配置失败。通过作者的亲身经历,揭示了在Spring框架配置文件中,一个小小的拼写错误如何引发大问题,并提供了具体的解决方案。
其实网上关于这个问题,讨论很多,对于一个初学者来说也是很有可能会遇到的问题,像我一样,也是把网上的方式试了很多,最终还是通知自己解决。虽说不是什么大问题,但是这种问题肯定也会浪费你不少时间。好吧,下面开始说说我提示这个错误的原因。
1、首先这个提示肯定是在于XML的配置,我当时是这么写的:
<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"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/aop
        https://www.springframework.org/schema/aop/spring-aop.xsd
        https://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd">
其实有一个不起眼的小细节,我把 https://www.springframework.org/schema/context这一句,多加了个"S",因此导致没有引用成功,希望大家也可以试试这个方法,反正我就是这个原因导致的。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值