spring boot部署mybatis填写代码之后,一直提示
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): mapper.geekopen.DeviceGeekOpenSettingMapper.getDeviceGeekOpenSettingList
初步判断是程序扫描不到 xml配置文件。
NO1 检查mapper 接口配置
检查 接口: 接口中添加了注释 @Mapper
@Mapper
public interface DeviceSettingMapper
检查启动扫描接口配置 @MapperScans
@MapperScans(value = {
@MapperScan("mapper"),
@MapperScan("mapper.aa"),
@MapperScan("mapper.nb"),
@MapperScan("mapper.dd")
})
No2 检查 xml扫描配置
配置:
#mybatis配置
mybatis:
#mapper.xml 文件位置
mapper-locations
具体配置如下:
#mybatis配置
mybatis:
#mapper.xml文件位置
mapper-locations:
- classpath:mappers/*.xml
- classpath:mappers/ee/*.xml
- classpath:mappers/RR/*.xml
#配置
configuration:
#日志输出到控制台
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#开启驼峰命名
map-underscore-to-camel-case: true