org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.zzstm.eduservice.mapper.EduCourseMapper.getPublishCourseInfo
报错原因 maven在加载时只加载.java文件,没有将mapper.xml文件编译到target目录,导致找不到
解决办法:
1、直接将xml文件复制到target的mapper目录里
2、把xml文件放在resource目录
3.通过配置文件配置(推荐)
(1)把这个放在pml.xml里
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
加完记得刷新maven
(2)在application.properties加
# 配置mapper.xml文件路径
mybatis-plus.mapper-locations=classpath:com/zzstm/eduservice/mapper/xml/*.xml
记得改自己的路径
然后重启程序。
如果发现仍然报错,看看target/mapper目录里有没有xml,如果没有
在这里找到你当前模块
双击4号 清除 然后双击5号重新打包就ok了