报错
org.apache.ibatis.binding.BindingException:
Invalid bound statement (not found):
无效的绑定语句(未找到):com.atProject.zhkt.vod.mapper.CourseMapper.selectCoursePublishVoById
原因
maven加载机制:
maven默认情况下,在src-main-java目录下面,maven只会加载java类型文件,其他类型文件不会加载的
如图:
target文件中没有xml文件,说明在src-main-java目录下面,maven只会加载java类型文件,其他类型文件不会加载的
解决:
1、直接复制xml文件到target文件中(破坏文件结构不建议)
2、在xml放到resources目录下(破坏文件结构,后续新建xml都要复制)
3、通过配置方式自动加载(直接进这个模块的父工程pom文件下配置xml文件扫描路径)
分为两方面pom.xml 和application
(1):在pom文件project标签内添加扫描路径
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes> <include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
(2)在resource文件的properties文件配置扫描路径
#配置xml扫描路径
mybatis-plus.mapper-locations=classpath:com/atProject/zhkt/vod/mapper/xml/*.xml
解决啦hhh,有帮到你请留个赞让我知道帮到你了,一起快乐翻倍!!!