Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type '' available: expected at least 1 bean which qualifies as autowire candidate.
问题描述
Spring报错:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type '' available: expected at least 1 bean which qualifies as autowire candidate.
解决方法:
查看spring扫描的表,是否包含Mapper接口的文件夹。
比如,在配置文件中配置:
<context:component-scan base-package="com.xxx"/>
那么 Mapper接口就只能写在 com.xxx 文件夹下面,否则spring扫描不到这个 Mapper接口,就会报错。