首先报这个错误,你得明白,是什么原因导致的?

  答:未引入命名空间,和约束文件

解决方法:

<?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>

元素“context:component-scan”的前缀“context”未绑定的更多相关文章

  1. 元素 "context:component-scan" 的前缀 "context" 未绑定的解决方案

    在动态web项目(Dynamic Web Project)中,使用SpringMVC框架,新建Spring的配置文件springmvc.xml,添加扫描控制器 <context:componen ...

  2. context:component-scan" 的前缀 "context" 未绑定。

    SpElUtilTest.testSpELLiteralExpressiontestSpELLiteralExpression(cn.zr.spring.spel.SpElUtilTest)org.s ...

  3. spring配置事务 元素 "tx:annotation-driven" 的前缀 "tx" 未绑定

    在进行spring与mybatis整合时,启动项目报错,控制台提示“元素 "tx:annotation-driven" 的前缀 "tx" 未绑定”. 经过查找, ...

  4. cache:annotation-driven" 的前缀 "cache" 未绑定

    问题: Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 29 in XML ...

  5. [Spring Boot] Use Component Scan to scan for Bean

    Component Scan is important concept when we want to create Bean. Currently we know what, for the cla ...

  6. [转载]Context and Interception : The .NET Context

    转载自:Context and Interception : The .NET Context Every new app domain starts with a single context, c ...

  7. Android在Context详细解释 ---- 你不知道Context

                                                                                                         ...

  8. spring注解注入:<context:component-scan>以及其中的context:include-filter>和 <context:exclude-filter>的是干什么的?

    转自:https://www.cnblogs.com/vanl/p/5733655.html spring注解注入:<context:component-scan>使用说明   sprin ...

  9. 为什么applicationContext.xml和spring-servlet.xml中都有注解过滤<context:component-scan base-package="myproject"> 和<context:component-scan base-package="myproject.controller" />

    在刚学习SpringMVC框架整合时,你也许会产生疑问为什么Spring.xml和SpringMVC.xml中都有注解过滤. <context:component-scan base-packa ...

  10. <context:component-scan>子标签:<context:include-filter>和<context:exclude-filter>使用时要注意的地方

    在Spring MVC中的配置中一般会遇到这两个标签,作为<context:component-scan>的子标签出现. 但在使用时要注意一下几点: 1.在很多配置中一般都会吧Spring ...

随机推荐

  1. springboot全局异常拦截源码解读

    在springboot中我们可以通过注解@ControllerAdvice来声明一个异常拦截类,通过@ExceptionHandler获取拦截类抛出来的具体异常类,我们可以通过阅读源码并debug去解 ...

  2. 读《深入理解Elasticsearch》点滴-multi_match

    区分按字段为中心的查询.词条为中心的查询 注意高频词项被高得分词项(冷僻的词项)取代的问题 1.best_fields :适用于多字段查询且查询相同文本:得分取其中一个字段的最高分.可通过tie_br ...

  3. Flask基础(04)-->相关配置参数

    # 导入Flask from flask import Flask from flask import config # 创建Flask的应用程序 app = Flask(__name__) #=== ...

  4. Python3爬虫基础实战篇之机票数据采集

    项目:艺龙国内机票实时数据爬虫 使用模块:requests(请求模块),js2py(js执行模块),json(解析json),xpath(解析网页). 项目流程: 分析网站数据来源. 编写爬虫脚本. ...

  5. MongoDB 学习笔记之 Nested doc/DBRef (Spark)

    Nested doc/DBRef (Spark) 实现: 运行结果:

  6. 阿里云Centos操作Mysql

    1.  CentOS7 yum方式安装MySQL5.7 2.Centos下mysql导入sql 3.Centos设置远程 4.CentOS下mysql数据库常用命令总结 5.centos出现“Fire ...

  7. ssrf漏洞学习(PHP)

    自己最近原本是想深入的学习一下关于xss.csrf的东西的,可是感觉这些东西需要有很好的js的基础来进行学习..还有感觉自己感觉也差不多该要学习内网渗透了..正好ssrf在内网这一块也是比较有用的.于 ...

  8. 重构网页过程中的小tips

    1.display为inline-block的元素可以使用virtical-align:middle来使得元素垂直居中对齐 2.在一些按钮标签或者mark标签中,如果文本内容确定不会改变长度的话,可以 ...

  9. e课表项目第二次冲刺周期第五天

    昨天干了什么? 昨天,我们组商量了主界面的主要设计,然后我查找了相关的资料,将主界面改成了一个连接数据库,并将数据库中的数据进行显示.接着,又在网上搜了一些资料,为数据建立了一个布局,能够显示该数据的 ...

  10. Java动手动脑第四讲课堂作业

    动手动脑1 完全“手写代码实现”随机数生成 纯随机数发生器