SpringMVC 错误分析:@Autowired Could not autowire field
来源:互联网 发布:java web项目面试题 编辑:程序博客网 时间:2024/06/01 10:48
http://blog.sina.com.cn/s/blog_4e64ae7a0106grdp.html
在开发SpringMVC中碰到了组件不能@Autowired的错误,以前好像也碰到过,怎么解决的忘记了,今天记在这里。可供碰到同样问题的朋友参考。
下面是Controller组件:
@Controller
public class ManageUserController {
}
其中Service组件为:
@Transactional
@Service("userService")
public class UserService implements UserServiceInf {
}
运行系统后总是出现userService不能autowired注入的错误。 费了半天劲,最后总是解决了。Spring的注入基于接口实现,基于接口的方式一是可以使得各个组件松耦合,而且也可以轻松的替代某一组件。
所以应该讲组件引用改为接口方式。
Controller组件中的userService组件应
由:private UserService userService;
改为: private UserServiceInf userService;
同理Service组件中的userDao组件应
由: private UserDao userDao;
改为: private UserDaoInf userDao;
0 0
- SpringMVC 错误分析:@Autowired Could not autowire field
- SpringMVC 错误分析:@Autowired Could not autowire field
- SpringMVC 错误分析:@Autowired Could not autowire field
- SpringMVC 错误分析:@Autowired Could not autowire field
- @Autowired:【Could not autowire field:】
- 新手学习spring boot,遇到@Autowired报Could not autowire field错误
- could not autowire field 错误解决方式
- Could not autowire field错误总结
- Could not autowire field
- Could not autowire field
- springmvc整合mybatis出现Could not autowire field:No matching bean of type错误
- [SpringMVC] Could not autowire field 异常的一种可能原因
- Injection of autowired dependencies failed nested exception is Could not autowire field No qualify
- BeanCreationException: Could not autowire field:解决方法
- 关于SpringMVC中org.springframework.beans.factory.BeanCreationException: Could not autowire field:的问题的解决
- mybatis错误org.springframework.beans.factory.BeanCreationException: Could not autowire field
- Could not autowire解决方法 INtellij IDEA @Autowired取消提示
- [Spring] Could not autowire field 异常的一种可能原因
- chrom浏览器模拟手机访问
- 用面向对象思维理解.NET委托:函数是对象、委托是函数对象的类型
- 网络编程--TCP-IP--2
- 用户登录中Cookie的简单应用
- 新的开始
- SpringMVC 错误分析:@Autowired Could not autowire field
- 关于Xcode 的一些调试技巧
- 欢迎使用CSDN-markdown编辑器
- java 泛型
- itemSelectedListener与itemClickListener的区别
- LeetCode -- Convert SortedList To BST
- Interface与abstract类的区别
- iOS中按比例剪切图片的方法
- AngularJS $http使用