Error creating bean with name 'itemController': Injection of autowired dependencies failed; nested e

亦凉 2022-05-15 00:29 251阅读 0赞

完整的错误是

  1. Error creating bean with name 'itemController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.e3mall.service.ItemService cn.e3mall.controller.ItemController.itemService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.e3mall.service.ItemService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  2. ----------------------------------------------------------------
  3. Could not autowire field: private cn.e3mall.service.ItemService cn.e3mall.controller.ItemController.itemService

仔细查看发现在ItemServiceImpl中忘记加了@Service

在控制层调用业务层的时候必须现在业务层进行注解

之后才能在控制层接入业务层

70

如果重启后还没有解决 ,多半是代码没有及时更新同步;

F5一下 项目 就解决了

发表评论

表情:
评论列表 (有 0 条评论,251人围观)

还没有评论,来说两句吧...

相关阅读