springboot整合mybatis-plus时不能读取到xml

问题:

 在我仔细检查了xml的配置和mapper、pojo等名称、更换版本、在pom.xml中加入resources标签后始终还是报如上错误:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.hyf.springredis.mapper.MenuMapper.getMenusByAdminId

文件格式如下:

 

 

解决:

检查了springboot的yml文件后发现了一个错误:我的yml文件中的mybatis-plus配置有问题

 

mybatis-plus:
  mapper-locations: class*:/mapper*.xml
  #  配置MyBatis数据返回类型别名(默认别名是类名)
  type-aliases-package: com.hyf.springredis.pojo
  configuration:
    map-underscore-to-camel-case: false

 

 我的mapper-locations属性写错了!!

我淦,之前怎么会这样写,如果mapper目录就在resources目录下面不写都是可以的,因为翻源码可以看到它的默认属性是“classpath*:/mapper/**/*.xml”

 

 

 

 
posted @ 2022-03-17 17:38  莫得感情的肝帝  阅读(940)  评论(0编辑  收藏  举报