在Spring Boot与Mybatis项目中,可以将*Mapper.xml文件和mapper接口一起放在mapper包中,这样找起来比较方便,但需要在pom.xml中配置下,如下:
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<!--配置此项是为了让maven搬运Java目录下的xml文件-->
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>