出现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

完美解决

原文地址:https://www.cnblogs.com/HezhenbinGoGo/p/13472383.html