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

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

解决方法:

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

最新文章

  1. 先说IEnumerable,我们每天用的foreach你真的懂它吗?
  2. Conherence Function
  3. Yocto开发笔记之《Tip-应用程序无法在目标机运行》(QQ交流群:519230208)
  4. 20160805_CentOS6_键盘快捷键
  5. angular 模板 小例子
  6. POJ 3662
  7. js 函数的传值问题
  8. xtraScrollableControl 滚动条随鼠标滚动
  9. 转:『代码』JS封装 Ajax级联下拉列表
  10. Python 环境
  11. Spring静态属性注入
  12. 怎么样学好C++
  13. [置顶] 关于本博客 http://www.imobilebbs.com
  14. 讲解mybaits的标签语法
  15. IOS8,IOS8.1等系统出现锁屏状态下WIFI断开问题的解决办法!
  16. js 学习之路6: if...else...条件语句的使用
  17. 【转】史上最详细的Composer安装tp5教程
  18. VMware卸载有残留,再安装时报错提示MSI Failed
  19. 有关python 函数参数
  20. Java学习路线思维导图

热门文章

  1. WebGL简易教程(五):图形变换(模型、视图、投影变换)
  2. 杭州蓝松科技---短视频SDK介绍
  3. Vue-cli连接mysql
  4. 基于 HTML5 WebGL 的垃圾分类系统
  5. windows下python和pycharm安装及其使用
  6. 设计模式----创建型模式之工厂模式(FactoryPattern)
  7. 手把手教你安装Eclipse最新版本的详细教程 - 大佬的鸡肋,菜鸟的盛宴(非常详细,非常实用)
  8. C#基于Quartz.NET实现任务调度并部署Windows服务
  9. 从0开始学FreeRTOS-1
  10. python编程基础之十五