Mybatis-Plus mapper扫描路径问题
时间:2020-10-31 08:40:11
收藏:0
阅读:1054
今天重新搭建SpringBoot项目融合MybatisPlus遇到一个问题“org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)”,这个问题是MybatisPlus没有扫描到mappers.xml引起的,解决方法如下:
- SpringBoot启动类Application加入注解
@MapperScan("com.package.mapper")
,这个是指向src目录中的mapper而非mapper.xml - 检查application.properties中
mapper-locations: classpath:/mapper/*Mapper.xml
,注意是 xxx/xxx/*Mapper.xml 而不是 xxx.xxx.xxx - pom导包为
mybatis-plus-boot-starter
原文:https://www.cnblogs.com/liaoweiming/p/13904725.html
评论(0)