MyBatis-Plus Property ‘mapperLocations‘ was not specified. 和 Invalid bound statement (not found)
在idea编辑器中使用SpringBoot整合MyBatis-Plus编译时出现 Property 'mapperLocations' was not specified.调用方法时出现:org.apache.ibatis.binding.BindingException:Invalid bound statement (not found)对于以上错误提示,主要是因为:对于IDEA系列编辑器,X
·
在idea编辑器中使用SpringBoot整合MyBatis-Plus
-
编译时出现
Property 'mapperLocations' was not specified.
-
调用方法时出现:
org.apache.ibatis.binding.BindingException:Invalid bound statement (not found)
对于以上错误提示,主要是因为:对于IDEA系列编辑器,XML 文件是不能放在 java 文件夹中的,IDEA 默认不会编译源码文件夹中的 XML 文件,可以参照以下方式解决:
- 将配置文件放在 resource 文件夹中
- 对于 Maven 项目,可指定 POM 文件的 resource
<build>
<resources>
<resource>
<!-- xml放在java目录下-->
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<!--指定资源的位置(xml放在resources下,可以不用指定)-->
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
更多细节请参考: MyBatis-Plus官方文档: 常见问题
更多推荐
已为社区贡献1条内容
所有评论(0)