小白白不白白
2020-01-16 10:37
采纳率: 37.5%
浏览 286

contorller中 中用注解调用ServiceImpl层异常,求前辈指点

我在contorller类中用注解的方式实现Service就会报错
图片说明
报错内容如下
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private supermarket.service.UserServiceSuper supermarket.controller.UserController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [supermarket.service.UserServiceSuper] 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), @org.springframework.beans.factory.annotation.Qualifier(value=userServiceMark)}



但是我若是用context去取userService就正常运行,UserServiceSuper userService=(UserServiceSuper)context.getBean("userServiceMark");
就是用注解就不行,我查了 网上说是@Autowired的错误,但我找不出来. 恳求前辈指点一下呀 感谢

问题关键就是controller层无法通过注解调用



图片说明


图片说明


图片说明


图片说明

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题