• 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>
  • 相关阅读:
    R语言常用操作
    Java小知识点
    客户端(android,ios)与服务器通信
    图片保存数据库
    Centos 添加SWAP(交换分区)
    mysql基本知识
    php 工作模式
    apache 工作模式
    lnmp 虚拟主机配置及重写
    mysql alter的常用用法
  • 原文地址:https://www.cnblogs.com/pu20065226/p/11122369.html
Copyright © 2020-2023  润新知