元素“context:component-scan”的前缀“context”未绑定
2024-09-05 11:15:44
首先报这个错误,你得明白,是什么原因导致的?
答:未引入命名空间,和约束文件
解决方法:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- 组件扫描器,主要是spring使用,用来扫描带有指定注解的类,将这些加载成BeanDefinition -->
<context:component-scan base-package="com.cyb.spring.service" />
</beans>
标签中加上
<!--命名空间-->
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/spring-beans.xsd
<!--别名-->
http://www.springframework.org/schema/context
<!--公网地址-->
http://www.springframework.org/schema/context/spring-context.xsd
若不加上命名空间的话bean得这样写
<beans:bean id="" class=""></beans>
最新文章
- 先说IEnumerable,我们每天用的foreach你真的懂它吗?
- Conherence Function
- Yocto开发笔记之《Tip-应用程序无法在目标机运行》(QQ交流群:519230208)
- 20160805_CentOS6_键盘快捷键
- angular 模板 小例子
- POJ 3662
- js 函数的传值问题
- xtraScrollableControl 滚动条随鼠标滚动
- 转:『代码』JS封装 Ajax级联下拉列表
- Python 环境
- Spring静态属性注入
- 怎么样学好C++
- [置顶] 关于本博客 http://www.imobilebbs.com
- 讲解mybaits的标签语法
- IOS8,IOS8.1等系统出现锁屏状态下WIFI断开问题的解决办法!
- js 学习之路6: if...else...条件语句的使用
- 【转】史上最详细的Composer安装tp5教程
- VMware卸载有残留,再安装时报错提示MSI Failed
- 有关python 函数参数
- Java学习路线思维导图
热门文章
- WebGL简易教程(五):图形变换(模型、视图、投影变换)
- 杭州蓝松科技---短视频SDK介绍
- Vue-cli连接mysql
- 基于 HTML5 WebGL 的垃圾分类系统
- windows下python和pycharm安装及其使用
- 设计模式----创建型模式之工厂模式(FactoryPattern)
- 手把手教你安装Eclipse最新版本的详细教程 - 大佬的鸡肋,菜鸟的盛宴(非常详细,非常实用)
- C#基于Quartz.NET实现任务调度并部署Windows服务
- 从0开始学FreeRTOS-1
- python编程基础之十五