SpringMVC 错误分析:@Autowired Could not autowire field
来源:互联网 发布:财务分析需要哪些数据 编辑:程序博客网 时间:2024/06/08 00:17
转自:http://blog.csdn.net/a5489888/article/details/8993593
在开发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;
- 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 异常的一种可能原因
- ServletContextListener实现全局配置装载入内存
- Android4.0 Keyguard解锁屏机制
- 欧洲陷入三大危机
- pgsql数据库和PHP中日期、时间戳处理函数
- Machine Learning - IV. Linear Regression with Multiple Variables多变量线性规划 (Week 2)
- SpringMVC 错误分析:@Autowired Could not autowire field
- Shell 输入/输出重定向
- Linux 软件包管理
- QT 5.0.2 QThread
- RESTLET框架学习
- jasperreport导出PDF中文不显示的问题
- Android 如何保证Service在后台不被kill?
- oracle常用命令
- xsl获取参数中的当前节点无效