Autowire
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的更多相关文章
- Spring学习记录(三)---bean自动装配autowire
Spring IoC容器可以自动装配(autowire)相互协作bean之间的关联关系,少写几个ref autowire: no ---默认情况,不自动装配,通过ref手动引用 byName---根据 ...
- 在servlet中用spring @Autowire注入
今天在改版以前应用程序的时候,发现很多系统是直接用servlet做的.当初也用到了spring,所以自然想到也用spring的@autowire注入来引入service层.但发现如果直接用,有时候成功 ...
- autowire异常的三个情况
2010-3-11 16:06:00 net.sf.ehcache.config.ConfigurationFactory parseConfiguration 警告: No configuratio ...
- [转载]Spring Autowire自动装配介绍
转自: http://www.cnblogs.com/zhishan/p/3190757.html 在应用中,我们常常使用<ref>标签为JavaBean注入它依赖的对象.但是对于一个大型 ...
- 自动装配【Spring autowire】
public class AutoWiringDao { private String daoName; public void setDaoName(String daoName) { this.d ...
- spring autoWire注解和@resource注解区别
1.autoWire注解主要是按类型匹配.因为autowire的扫描机制,是按照接口类型来扫描bean的. 而JSR250 @resource注解是通过名称扫描注入的. @autowire注解的扫描方 ...
- spring autoWire注解
1.autowire注解,可以用来获得applicationContext,ResourceLoader,BeanFactory的注入 autoWire会获得相应资源 2.autoWire注解还可以用 ...
- Spring Autowire自动装配介绍
在应用中,我们常常使用<ref>标签为JavaBean注入它依赖的对象.但是对于一个大型的系统,这个操作将会耗费我们大量的资源,我们不得不花费大量的时间和精力用于创建和维护系统中的< ...
- Spring Autowire自动装配
在应用中,我们常常使用<ref>标签为JavaBean注入它依赖的对象.但是对于一个大型的系统,这个操作将会耗费我们大量的资源,我们不得不花费大量的时间和精力用于创建和维护系统中的< ...
- IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示
1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示.但程序的编译和运行都是没有问题的, ...
随机推荐
- 时序数据库技术体系 – InfluxDB TSM存储引擎之TSMFile
本文转自 http://hbasefly.com/2018/01/13/timeseries-database-4/ 为了更加系统的对时序数据库技术进行全方位解读,笔者打算再写一个系列专题(嘿嘿,好像 ...
- 使用javascript来访问本地文件夹
常用的.net 的aspx文件由于运行在服务器端,并不具有访问用户本地文件夹的权限,导致类似于<a href="file:///d:/backup" > open fo ...
- java利用反射机制判断对象的属性是否为空以及获取和设置该属性的值
1.java利用反射机制判断对象的属性是否为空: Map<String,String> validateMap = new LinkedHashMap<String, String& ...
- linux的简单查找的方法
catalina.out文件查找指定行sed -n 346492p catalina.out 查找第几到第几行sed -n 346200,346692p catalina.out 查找指定内容(不区分 ...
- js功能实现的特效--距离新年还有多少天
代码: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> & ...
- react 快速 点击
用 fastclick npm 一下 他 就可以
- Android 中各种权限深入体验及详解
Android 中各种权限深入体验及详解 分类: Android2012-07-15 19:27 2822人阅读 评论(0) 收藏 举报 androidpermissionsinstallersyst ...
- Every write operation executed on a document, deletes included
Delete API | Elasticsearch Reference [6.5] | Elastic https://www.elastic.co/guide/en/elasticsearch/r ...
- OKEx量化分析报告[2017-12-19]
[分析时间]2017-12-19 09:05 [分析对象]OKEx [有效期限]2017-12-19 09:00:00 — 2017-12-19 09:59:59 [报告内容]DASH_USDT ...
- Cache与主存之间的全相联映射,直接映射和组相联映射的区别
2017-02-22 注:本文并非原创,来自百度文库,只是觉得写得较好,故分享之.若是某人的知识产权,望告知!谢谢 1.高速缓冲存储器的功能.结构与工作原理 高速缓冲存储器是存在于主存与CPU之间的一 ...