The XML file configuration reports an error in the java directory and the mapper cannot be found (not found)

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigulz.eduservice.mapper.EduCourseMapper.getCoursePublishVoInfo
	at com.baomidou.mybatisplus.core.override.PageMapperMethod$SqlCommand.<init>(PageMapperMethod.java:261)
	at com.baomidou.mybatisplus.core.override.PageMapperMethod.<init>(PageMapperMethod.java:58)
	at com.baomidou.mybatisplus.core.override.PageMapperProxy.cachedMapperMethod(PageMapperProxy.java:70)
	at com.baomidou.mybatisplus.core.override.PageMapperProxy.invoke(PageMapperProxy.java:63)
	at com.sun.proxy.$Proxy95.getCoursePublishVoInfo(Unknown Source)
	at com.atguigulz.eduservice.service.impl.EduCourseServiceImpl.getCoursePublishVoInfo(EduCourseServiceImpl.java:103)

Solution:
1. Configure the following nodes in the pom of guli_edu (under the home directory)

<!-- 项目打包时会将java目录中的*.xml文件也进行打包 -->
<build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

2. Add configuration in the Spring Boot configuration file

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

Method 2: Or copy the xml file in src to the project corresponding to the target's classes

Original link: http://zhenyunboy.icu/?p=274

Guess you like

Origin blog.csdn.net/qq_34134299/article/details/109115423