在SpringBoot 集成 Mybatis 时,在Eclipse里运行项目一切正常,但打包成 jar 文件在命令行支行时报错:
Invalid bound statement (not found): xxx.xxxx.method
在检查mapper.xml文件里的配置均无错后,
则需要在pom.xml文件里加入以下内容:
<resources>
<resource>
<directory>src/main/java</directory>
<!-- Mapper.xml文件位置 -->
<includes>
<include>**/mapper/**/*.xml</include>
</includes>
</resource>
<!--指定资源的位置-->
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
重新打包成 jar 运行成功!