zoukankan      html  css  js  c++  java
  • 项目启动报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wuhongyu.mapper.OrdersMapper.selectByExample

    • 在用maven配置mybatis环境时出现此BindingExceptiony异常,发现在classes文件下没有mapper配置文件,应该是maven项目没有扫描到mapper包下的xml文件,

    • 在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>  
      </build>


  • 相关阅读:
    学习进度条05
    构建之法阅读笔记03
    子数组和最大值算法
    学习进度条04
    学习进度条03
    定制小学四则运算
    单元测试示例
    构建之法阅读笔记02
    学习进度条02
    decimal扩展方法(转换为字符串,去掉末尾的0)
  • 原文地址:https://www.cnblogs.com/qianzf/p/11288141.html
Copyright © 2011-2022 走看看