【bug】Could not autowire field:

报错的语句:

Could not autowire field: private com.taotao.content.service.ContentCategoryService com.taotao.controller.ContentController.contentCategoryService;

出现此问题的解决方法 :

  1. 检查service配置文件中是否开启了包扫描
  2. 检查service实现类中是否进行了注解@Service。(即使在dubbo中未发布的service接口,但若在包扫描的包中也需要进行添加注解。报错的时候不会报未添加的注解错误,所以要小心)
  3. 检查service配置文件中使用dubbo发布和web层的引用是否一致
  4. 检查Controller中的添加注解字母是否打错了。和web层中SpringMVC配置文件id不一致
  5. 最后完成之后记住要在maven中及时安装修改后的文件

【bug】Could not autowire field:

同时还会有Error creating bean with name这个错误,不过解决完上一个cuy 错误,这个也就消失了。