No qualifying bean of type ‘...‘ available错误解决

nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.core.task.AsyncTaskExecutor' available: expected at least 1 bean which qualifies as autowire candidate. 
Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=asyncQualityKafkaConsumeExecutor), @org.springframework.beans.factory.annotation.Autowired(required=true)}

关键报错内容:

No qualifying bean of type 'org.springframework.core.task.AsyncTaskExecutor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: 
{@org.springframework.beans.factory.annotation.Qualifier(value=asyncQualityKafkaConsumeExecutor), @org.springframework.beans.factory.annotation.Autowired(required=true)}

解决方法:查看源代码:

@Qualifier("asyncQualityKafkaConsumeExecutor")
@Autowired
private AsyncTaskExecutor asyncQualityKafkaConsumeExecutor;

这里@Qualifier已经注入了一次,多注入了一个@Autowired,将@Autowired注释掉之后,问题解决。

你可能感兴趣的:(java学习笔记,java,前端,开发语言)