NoSuchBeanDefinitionException: No qualifying bean of type ‘com.qianfeng.provider.dao.user.UserMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
原因排查
- 配置扫描bean时没有扫描到dao层所在的包
<context:component-scan base-package=“com.silencer.web.dao” />
2. dao层类上没有添加@Repository注解
@Repository
public interface UserMapper extends BaseMapper {}
3. 配置接口层映射mybatis查询时,没有配置dao层扫描器