No qualifying bean of type 'xxx' found for dependency 问题解决

报错:

Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type [com.×××项目名.service.ContractService] found for
dependency
No qualifying bean of type 'xxx' found for dependency

原因:

缺少依赖标记,比如@Autowired,@Override,@Service(“×××Service”)

解决办法:

根据报错信息,找到出错的文件,我这里是service文件报错,发现是serviceImpl文件没加标记@Service(“contractService”) 。

  • 修改前
    No qualifying bean of type 'xxx' found for dependency 问题解决_第1张图片
  • 修改后
    No qualifying bean of type 'xxx' found for dependency 问题解决_第2张图片

建议:

检查一下报错文件,是不是少加了依赖标记!

你可能感兴趣的:(SpringMVC,Spring,SSM框架搭建)