超全超详细解读,mybatis报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误

值得参考的一种:
https://blog.csdn.net/myhes/article/details/86430126

补充:
1.如果需要配置多个包下的内容,在application.yml中可以是用这样的配置
目录结构如下
超全超详细解读,mybatis报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误_第1张图片
配置文件

mybatis:
  mapper-locations: classpath:mapper/**/*.xml
  configuration:
    map-underscore-to-camel-case: true
  type-aliases-package: com.newretail.modules.*.domain

MyBatis 配置项解读:

config-location:指定 MyBatis 主配置文件的位置
mapper-locations:指定 mapper 文件的位置。如果在项目中你的 mapper 文件是按目录来放置,那么对应的配置就变成:mapper-locations: classpath:mapper/*/*.xml

补充2 ;

在服务器中上传了jar以后还是会出现问题;
原因
在jar的同级目录 有config文件夹
里面有配置文件的application.xml,会优先这个文件下的配置文件
然后才是程序中的配置文件

SpringBoot 配置文件位置及读取优先级

你可能感兴趣的:(Spring,Boot,mybatis)