zoukankan      html  css  js  c++  java
  • springboot+mybatis报错Invalid bound statement (not found)

    今天做项目时报了一个错提示说Invalid bound statement (not found),也就是说mapper接口绑定.xml文件出错了,找不到指定的sql;原因是程序没有把.xml文件编译到classes路径下,这时需要在pom.xml文件的<build>标签中加入下面的配置解决
    <resources>
    <!-- maven项目中src源代码下的xml等资源文件编译进classes文件夹,
    注意:如果没有这个,它会自动搜索resources下是否有mapper.xml文件,
    如果没有就会报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.pet.mapper.PetMapper.selectByPrimaryKey-->
    <resource>
    <directory>src/main/java</directory>
    <includes>
    <include>**/*.xml</include>
    </includes>
    </resource>

    <!--将resources目录下的配置文件编译进classes文件 -->
    <resource>
    <directory>src/main/resources</directory>
    </resource>
    </resources>
  • 相关阅读:
    2016华中农业大学预赛 E 想法题
    2016华中农业大学预赛 B 数学
    render()
    钩子函数
    redirect_uri域名与后台配置不一致,错误码:10003
    群发次数
    表名
    intval()函数
    render()
    $this->autoRender = false
  • 原文地址:https://www.cnblogs.com/xkjy/p/11603475.html
Copyright © 2011-2022 走看看