zoukankan      html  css  js  c++  java
  • 出现org.apache.ibatis.binding.BindingException异常

     出现绑定式异常

    查看target文件夹里面再mapper中,发现运行时缺少xml文件

    解决办法

    1、将xml文件复制到target中Mapper文件夹下面。

    2、将xml放到resource目录下

    3、配置文件

    配置文件

    1、在pom文件中添加,指定xml文件位置

     1 <!-- 项目打包时会将java目录中的*.xml文件也进行打包 -->
     2 <build>
     3   <resources>
     4     <resource>
     5       <directory>src/main/java</directory>
     6     <includes>
     7       <include>**/*.xml</include>
     8     </includes>
     9       <filtering>false</filtering>
    10     </resource>
    11   </resources>
    12 </build>

    2、在Spring Boot配置文件中添加配置

    #配置mapper xml文件的路径
    mybatis-plus.mapper-locations=classpath:com/xxx/xxx/mapper/xml/*.xml

    完美解决

  • 相关阅读:
    MySQL之force index和ignore index
    Linux中CPU性能分析工具perf简单使用(亲测可用)
    Linux之SeLinux
    Docker基础
    yum常用命令
    MySQL总结
    MySQL字符集详解
    MySQL5.6的4个自带库详解
    Python操作MySQL
    MySQL索引原理
  • 原文地址:https://www.cnblogs.com/HezhenbinGoGo/p/13472383.html
Copyright © 2011-2022 走看看