Invalid bound statement (not found)--spring boot集成mybatis
Posted pu20065226
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Invalid bound statement (not found)--spring boot集成mybatis相关的知识,希望对你有一定的参考价值。
问题:
"timestamp":"2019-07-02T10:21:32.379+0000","status":500,"error":"Internal Server Error","message":"Invalid bound statement (not found): com.example.mybatistest.mapper.ISelectIdMapper.selectId","path":"/queryIdByName"
解决:
1.appliation.yml中要加上xml配置,我就是这个问题
mybatis: configuration: # map-underscore-to-camel-case: true log-impl: org.apache.ibatis.logging.stdout.StdOutImpl mapper-locations: classpath:mappers/*.xml
2.xml中namespace中配置的mapper一定要正确,我的是com.exa前引号后多了一个空格,让我找了两天才找出来。
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.example.mybatistest.mapper.ISelectIdMapper"> <select id="selectId" resultType="String"> select id from t_user where name=#name </select> </mapper>
以上是关于Invalid bound statement (not found)--spring boot集成mybatis的主要内容,如果未能解决你的问题,请参考以下文章
Invalid bound statement not found
Invalid bound statement (not found) 错误原因
报错 Invalid bound statement (not found): com.xxx.mapper.xxx
Invalid bound statement (not found)