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

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

解决方法:

<?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. java跬步积累

    1.eclipse自动生成get/set方法快捷键 alt+shift+s +r 2.eclipse自动生成等号左边快捷键 将光标移到:号右边,然后按Ctrl+1 3.补全代码快捷键 Alt+/ 4. ...

  2. 微信小程序项目-你是什么垃圾?

    垃圾分类特别火也不知道北京什么时候也开始执行,看见之前上海市民被灵魂拷问了以后垃圾真的不知道如何丢了,作为程序员就做一个小程序造福人类吧. 效果图: 一.全局的app.json和app.wxss加入了 ...

  3. .NET进阶篇-丑话先说,Flag先立--致青春

    作为开发者,工作了半年,也总觉得技术栈和刚毕业区别不大,用的技术还都是N年前的,每每看到新东西,也只心里哇塞惊叹一下,然后就回归于忙碌.怪自己的技术池太浅,热门的令人称奇的技术也都是在其他巨人的肩膀上 ...

  4. Ionic2优于Ionic1的6个理由

    经历了一个从0到有的app的开发,我已经很熟悉Ionic1了,在此期间我曾发现过Ionic1的一些bug,和一些不合理的地方(根基版本 不同,后续我会陆续发表这些文章),我甚至在此期间对Ionic1进 ...

  5. win7环境搭建以太坊私链

    如何创建私链: 创建创世配置文件: 首先需要创建一个“创世”json配置文件,此文件描述了创世区块的一些参数.下面就是文件中的内容: { "coinbase": "0x0 ...

  6. DOM操作方法、属性

    话不多说直接上demo: <!DOCTYPE html> <html lang="en"> <head> <meta charset=&q ...

  7. STM32之串口DMA接收不定长数据

    STM32之串口DMA接收不定长数据 引言 在使用stm32或者其他单片机的时候,会经常使用到串口通讯,那么如何有效地接收数据呢?假如这段数据是不定长的有如何高效接收呢? 同学A:数据来了就会进入串口 ...

  8. .netCore+Vue 搭建的简捷开发框架--目录

    .netCore+Vue 搭建的简捷开发框架 .netCore+Vue 搭建的简捷开发框架 (2)--仓储层实现和EFCore 的使用 .netCore+Vue 搭建的简捷开发框架 (3)-- Ser ...

  9. 解决VS2017授权问题及没有Add ArcGIS License Checking问题

    内容源自:ArcGIS Engine+C#入门经典 老版本采用: 控件布局好后,需要对程序添加License许可.在Visual Studio的菜单栏上单击“项目”→单击“Add ArcGIS Lic ...

  10. Ubuntu分区方案

    swap: 4G(跟你自己内存一样大):主分区:空间起始位置:用于交换空间 /boot: 300M(太小会导致软件无法升级):逻辑分区:空间起始位置:EXT4:/boot /: 30G:主分区:空间起 ...