Field userService in com.demo.web.Controller.HomeController required a single bean, but 2 were found:
    - userServiceImpl: defined in file [C:\Users\xxxx\Desktop\r\maven-projects\web-app\target\classes\com\demo\web\Controller\UserServiceImpl.class]
    - IUserService: defined in file [C:\Users\xxxx\Desktop\r\maven-projects\web-app\target\classes\com\demo\web\Controller\IUserService.class]

一、指定bean名字为 userServiceImpl
    @Autowired
    private IUserService userServiceImpl;

二、在@Service里指定服务名字

@Service("userService")
public class UserServiceImpl implements IUserService { @Autowired
private IUserService userService;

Autowire的更多相关文章

  1. Spring学习记录(三)---bean自动装配autowire

    Spring IoC容器可以自动装配(autowire)相互协作bean之间的关联关系,少写几个ref autowire: no ---默认情况,不自动装配,通过ref手动引用 byName---根据 ...

  2. 在servlet中用spring @Autowire注入

    今天在改版以前应用程序的时候,发现很多系统是直接用servlet做的.当初也用到了spring,所以自然想到也用spring的@autowire注入来引入service层.但发现如果直接用,有时候成功 ...

  3. autowire异常的三个情况

    2010-3-11 16:06:00 net.sf.ehcache.config.ConfigurationFactory parseConfiguration 警告: No configuratio ...

  4. [转载]Spring Autowire自动装配介绍

    转自: http://www.cnblogs.com/zhishan/p/3190757.html 在应用中,我们常常使用<ref>标签为JavaBean注入它依赖的对象.但是对于一个大型 ...

  5. 自动装配【Spring autowire】

    public class AutoWiringDao { private String daoName; public void setDaoName(String daoName) { this.d ...

  6. spring autoWire注解和@resource注解区别

    1.autoWire注解主要是按类型匹配.因为autowire的扫描机制,是按照接口类型来扫描bean的. 而JSR250 @resource注解是通过名称扫描注入的. @autowire注解的扫描方 ...

  7. spring autoWire注解

    1.autowire注解,可以用来获得applicationContext,ResourceLoader,BeanFactory的注入 autoWire会获得相应资源 2.autoWire注解还可以用 ...

  8. Spring Autowire自动装配介绍

    在应用中,我们常常使用<ref>标签为JavaBean注入它依赖的对象.但是对于一个大型的系统,这个操作将会耗费我们大量的资源,我们不得不花费大量的时间和精力用于创建和维护系统中的< ...

  9. Spring Autowire自动装配

    在应用中,我们常常使用<ref>标签为JavaBean注入它依赖的对象.但是对于一个大型的系统,这个操作将会耗费我们大量的资源,我们不得不花费大量的时间和精力用于创建和维护系统中的< ...

  10. IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示

    1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示.但程序的编译和运行都是没有问题的, ...

随机推荐

  1. 第1章 部署虚拟环境安装linux系统

    章节简述: 本章节带领读者从0基础了解虚拟机软件与红帽系统,完整的演示了在VM与KVM中安装红帽RHEL7系统的方法. 特别增加了超级实用的Linux系统找回root密码.虚拟机功能增强包.VNC远程 ...

  2. DistroWatch评估XStream桌面153版本

    导读 XStreamOS是一个由Sonicle创建的Solaris的一个版本.XStream桌面将Solaris的强大带给了桌面用户,同时新手用户很可能有兴趣体验一下.DistroWatch对于XSt ...

  3. vue axios配置 发起请求加载loading请求结束关闭loading

    axios带有请求拦截器,避免在每个请求里面加loading重复操作,可以封装进去,在请求开始时加载loading层,请求结束关闭,loading层用vux的loading加载 axios.js im ...

  4. Hibernate的大对象映射

    1在持久类中直接声明是java.sql.Blob类型 2在.hbm.xml文件中配置一下信息 <!-- 映射大对象 (就是字符长度超过255和图片想转换成二进制的数据)--> <!- ...

  5. Sublime Text 3如何编译运行c++程序

    扯 去了一趟清北学堂感觉自己玩的特别嗨,算法没学到什么,前端和爬虫的知识到是会了不少. 然后知道了有一个叫做sublime text 3的编辑器,好用不好用不知道,就冲着它好看,就决定以后就用它了. ...

  6. linLINUX中常用操作命令

    LINUX中常用操作命令 Linux简介及Ubuntu安装 常见指令 系统管理命令 打包压缩相关命令 关机/重启机器 Linux管道 Linux软件包管理 vim使用 用户及用户组管理 文件权限管理 ...

  7. ambari安装集群下python连接hbase之安装thrift

    简介: python连接hbase是需要通过thrift连进行连接的,ambari安装的服务中貌似没有自带安装hbase的thrift,我是看配置hbase的配置名称里面没有thrift,cdh版本的 ...

  8. python 时间与时间戳之间的转换

    https://blog.csdn.net/kl28978113/article/details/79271518 对于时间数据,如2016-05-05 20:28:54,有时需要与时间戳进行相互的运 ...

  9. Python 之RabbitMQ使用

    1. IO 多路复用 # select 模拟socket server # server 端 import select import socket import sys import queue s ...

  10. java基础05 选择结构

    选择结构 public class Demo01Change { public static void main(String[] args) { /** * 实现等量的转换 */ int a = 5 ...