No qualifying bean of type [xxx] found for dependency

描述

  • org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xxx’:Injection of resource dependencies failed
  • org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [xxx] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency

问题来源

  • xml配置文件中没有启用注解功能或者扫描包路径错误
  • xxxServiceImpl实现类没有使用@Service注解
  • xxxService调用错误,出现自己调自己的情况
	
		<context:component-scan base-package="xxx.xxx.xxx"/>

//此处没有使用@service
@Service
public class OperatorServiceImpl implements OperatorService {
     

	/* 自己调自己
	@Resource
	private OperatorService operatorService;
	*/
	
	@Resource
	private OperatorDao operatorDao;
	

你可能感兴趣的:(Exception)