在pom.xml中加如下代码
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> <!-- ......用于扫描 dao 文件下的mapper 文件................. start --> <resources> <!-- 编译 src/main/java 目录下的 mapper 文件 --> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> <!-- ......用于扫描 dao 文件下的mapper 文件................. end --> </build>
springboot-mybatis 解决Mapper接口与Mapper.xml在同一包下不编译Mapper.xml文件问题