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的错误提示.但程序的编译和运行都是没有问题的, ...
随机推荐
- Eclipse之相关快捷键
Eclipse的编辑功能非常强大,掌握了Eclipse快捷键功能,能够大大提高开发效率.Eclipse中有如下一些和编辑相关的快捷键. 1.[ALT+/] 此快捷键为用户编辑的好帮手,能为用 ...
- SSH电力项目一 搭建Hibernate框架
Hibernate所需要的基本文件: ElectText.java ElecText.hbm.xml hibernate.cfg.xml 第一步:创建测试表Elec_Text: create tabl ...
- Code Forces 26C Dijkstra?
C. Dijkstra? time limit per test 1 second memory limit per test 64 megabytes input standard input ou ...
- tomcat------->简单配置
主机名:www.snowing.com 域名:snowing.com http://主机+服务器端口号/path(web应用)/xxx.html 例: http://localhost:8080/it ...
- 【Python算法】渐进记法 与 性能测量工具cProfile
对于某个比较简单的算法,我们有时候确实能够精确地分析出算法的复杂度. 比如算法复杂度为5n^2+10n+6,但是事实上并不需要这样,因为当n足够大时,可以忽略掉低阶项和最高次项的系数,因此就引出了“渐 ...
- FormsAuthentication 使用指南
配置安全鉴别 鉴别是指鉴定来访用户是否合法的过程.ASP.NET Framework支持三种鉴别类型: Windows鉴别: NET Passport鉴别: Forms鉴别. 对于某一特定的应用程序, ...
- Golang&Python测试thrift
接上篇,安装好之后,就开始编写IDL生成然后测试. 一.生成运行 参考 http://www.aboutyun.com/thread-8916-1-1.html 来个添加,查询. namespace ...
- redis之数据操作详解
redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(sorted set ...
- python-gitlab 模块
安装:pip install python-gitlab import gitlab # 登录 gl = gitlab.Gitlab('http://127.0.0.1', private_token ...
- POJ 3171
题目大意: 给定一个区间范围[M,E],接下来有n行输入.每行输入三个数值:T1,T2,S,表示覆盖区间[T1,T2] 的代价为S,要求你求出覆盖区间[M,E]的最小代价,假设不能覆盖, ...