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

problem:

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

solve:

1.appliation.yml xml configuration you want to add, I'm the problem

mybatis:
  configuration:
    #    map-underscore-to-camel-case: true
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  mapper-locations: classpath:mappers/*.xml

2.xml the namespace configured mapper must be correct, I was front com.exa quote one more space, so I looked for two days to find out.

<?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>

 

Guess you like

Origin www.cnblogs.com/pu20065226/p/11122369.html