使用mybatis出现异常

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xiaohe.mapper.EduCourseMapper.getPublishCourseInfo
== 分析:maven项目在编译过程中,java目录下面的.java文件才会编译运行,详细看target目录,当xml写在mapper则不能实现sql功能==
目录格式:

解决方案

1、在pom中添加

   <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
    </build>

2、在application.yml中添加

mybatis-plus:
  mapper-locations: classpath:com/xiaohe/mapper/xml/*.xml

解决

posted @ 2021-01-22 15:47  池三岁  阅读(190)  评论(0编辑  收藏  举报