org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

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了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值