首先查看target中有没有Mapper和Mapper.xml如果有仔细查看文件后缀是否正确,如xxx.xml,
如果没有的话,试着用以下方式解决:
1.查看Mapper.xml中<Mapper namespace="路径是否正确,是否正确指到Mapper">
2.查看Mapper.xml中<resultMap id="xxxx" type="此路径是否正确指到bean">
3.在Spring boot启动类加上@MapperScan("src/main/java/com/mapper")地址指向Mapper根目录
4.在pom中添加扫描,
<resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.*</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/**</include> </includes> <filtering>true</filtering> </resource> </resources>