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. Zabbix-3.0.3结合Grafana-3.1.0给你想要的绘图

    导读 Grafana 是 Graphite 和 InfluxDB 仪表盘和图形编辑器.Grafana 是开源的,功能齐全的度量仪表盘和图形编辑器,支持 Graphite,InfluxDB 和 Open ...

  2. fopen与读写的标识r,r+,rb+,rt+,w+.....

    FILE * fopen(const char * path,const char * mode); 参数mode字符串则代表着流形态. mode有下列几种形态字符串: r 打开只读文件,该文件必须存 ...

  3. js实现输入框联想搜索

    实现点击和输入搜索联想,把搜索出的列表放到下面的ul列表中,然后再列表中选择并把公司名赋值给输入框,把guid赋值给隐藏域 html <input type="hidden" ...

  4. [Android Tips] 27. 检查 APK 是否可调试

    使用 Android SDK 提供的 aapt 检查 APK 文件 $ aapt d badging ${APK_FILE} | grep 'application-debuggable' 检查自身 ...

  5. vsftp or pureftpd

    一.安装pureftpd //这个软件比vsftp配置起来更加灵活和安全. /*官网是 http://www.pureftpd.org/project/pure-ftpd*/ [root@localh ...

  6. Spring WebSocket实现消息推送

    第一步: 添加Spring WebSocket的依赖jar包 (注:这里使用maven方式添加 手动添加的同学请自行下载相应jar包放到lib目录) <!-- 使用spring websocke ...

  7. 字符串与图片的Base64编码转换操作

    //图片 转为 base64编码的文本 private void button1_Click(object sender, EventArgs e) { OpenFileDialog dlg = ne ...

  8. Threaten Model

    探测(扫描器,情报搜集)--入侵(vul,exp)--潜伏(RATS,setmft,AFSET)--横向入侵(admin cert,RATS)---信息泄漏(vpn,rats,通讯通道)--删除踪迹( ...

  9. 设计模式之Factory工厂模式

    在上一章,模板模式中,我们在父类规定处理的流程,在子类中实现具体的处理.如果我们将该模式用于生成实例,便演变成了Factory模式,即工厂模式. 在Factory模式中,父类决定实例的生成方式,但并不 ...

  10. sublime text 3 配置方法

    一.安装sublime text 3 1>.执行sublime text 3的安装包(.exe)文件安装成功后,进入sublime的安装目录(例如:D:\Program Files\Sublim ...