问题描述:
警告: nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'class path resource [xxx.xml]'; nested exception is java.io.FileNotFoundException: class path resource [xxx.xml] cannot be opened because it does not exist
原因:
如mapper.xml放在接口路径下,Maven无法直接读取
解决方法:
在pom.xml中配置文件过滤规则
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>