1、eclipse中使用jetty容器,使用jetty版本6.1.26运行良好;在命令行启动:mvn jetty:run,却报出异常:不能注入
- 2011-12-27 14:44:55,602 [ERROR] org.springframework.web.servlet.DispatcherServlet:290 - Context initialization failed
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hummockAppController': Autowiring of fields failed;
- nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public com.alibaba.hummock.console.se
- rvice.HummockAppService com.alibaba.hummock.console.controller.HummockAppController.hummockAppService; nested exception is org.springframewo
- rk.beans.factory.BeanCreationException: Error creating bean with name 'hummockAppServiceImpl': Autowiring of fields failed; nested exception
- is ......
仔细检查了代码,@Autowired使用都正确。为什么???
仔细思考后,发现pom里面使用的jetty插件为:6.1.22版本,难道是这个原因?
解决方案:将pom中jetty的版本改为6.1.26后,在命令行正确启动了。
本文转自 zhouhaipeng 51CTO博客,原文链接:http://blog.51cto.com/tianya23/752152,如需转载请自行联系原作者