搭建springboot项目启动报错在service实现层找不到mapper接口类
Field xxxMapper in xxx.service.impl.xxxServiceImpl required a bean of type 'xxx.mapper.xxxMapper' that could not be found.
解决办法:
一、在mapper上添加注解@Mapper
二、在启动类Application上添加注解@MapperScan
注意@MapperScan需要以下依赖
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.0.1</version> </dependency>