通过解决Invalid bound statement (not found),剖析mybatis加载Mapper接口、Mapper.xml以及将两者绑定的过程。
项目刚开始使用了spring boot mybatis:
1.配置扫描mapper接口
@MapperScan("com.outreach.server.mapper")
2.在application.yml中配置Mapper.xml的扫描路径
# Mybatis-plus配置
mybatis-plus:
# 配置Mapper映射文件
mapper-locations: classpath*:/mapper/*Mapper.xml
# 配置MyBatis数据返回类型别名(默认别名是类名)
type-aliases-package: com.outreach.server.entity
configuration:
# 自动驼峰命名
map-underscore-to-camel-case: false


