java编写项目时出现Error creating bean with name 'xxController': Unsatisfied dependency expressed through field'xxx'

今天在写项目时,遇到了一个500的错误,废话不多说,直接上图
java出现Error creating bean with name xxController Unsatisfied dependency expressed through fieldxx

错误信息如下:

Error creating bean with name ‘mainController’: Unsatisfied dependency expressed through field ‘movieService’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.offcn.movie.service.MovieService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
翻译为:创建名为“mainController”的bean时出错:通过字段“movieService”表达的不满足的依赖关系;

导致这个错误的原因是因为在movieService接口的实现类里面没有加注解java出现Error creating bean with name xxController Unsatisfied dependency expressed through fieldxx
正确做法是在实现类中加入@Service注解,再刷新一遍问题就解决了。
java出现Error creating bean with name xxController Unsatisfied dependency expressed through fieldxx
输入可能飘红线 ,按‘alt’+‘/’ 导入即可。

相关文章:

  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2021-05-29
  • 2022-12-23
  • 2021-07-09
猜你喜欢
  • 2021-11-07
  • 2021-03-30
  • 2022-12-23
  • 2021-12-12
  • 2021-08-30
  • 2021-12-24
  • 2021-11-14
相关资源
相似解决方案