码迷,mamicode.com
首页 > 编程语言 > 详细

Invalid bound statement (not found)--spring boot集成mybatis

时间:2019-07-02 19:33:32      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:map   nal   core   ati   div   mes   res   enc   status   

问题:

{"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

标签:map   nal   core   ati   div   mes   res   enc   status   

原文地址:https://www.cnblogs.com/pu20065226/p/11122369.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!