Mybatis-Plus mapper扫描路径问题

  今天重新搭建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
posted @ 2020-10-30 22:55  廖伟名  阅读(5397)  评论(0编辑  收藏  举报