java出现Error creating bean with name xxController Unsatisfied dependency expressed through fieldxx

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’+‘/’ 导入即可。