springboot整合mybatis-plus遇到的问题扫描不到Mapper接口

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.zhao.mapper.UserMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

在这里插入图片描述
之前整合过一次了没有出现过这种问题,不知道是不是因为整合Druid出现的问题(很是疑惑)

解决方法

方法一:通过@Mapper注解去扫描一下我们的Mapper接口

在这里插入图片描述

方法一:通过在主入口使用@MapperScan注解去扫描一下我们的Mapper包

在这里插入图片描述


版权声明:本文为qq_43521797原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。