测试:报告异常
AbstractHandlerExceptionResolver
.java
:194 |org
.springframework
.web
.servlet
.mvc
.method
.annotation
.ExceptionHandlerExceptionResolver
|Resolved exception caused by handler execution
: org
.apache
.ibatis
.binding
.BindingException
: Invalid bound statement
(not found
): com
.guli
.edu
.mapper
.CourseMapper
.getCoursePublishVoById
问题分析
dao层编译后只有class文件,没有mapper.xml,因为maven工程在默认情况下src/main/java目录下的所有资源文件是不发布到target目录下的,
解决方案
在pom中配置如下节点
<build>
<resources>
<resource>
<directory>src/main/java
</directory>
<includes>
<include>**/*.xml
</include>
</includes>
<filtering>false
</filtering>
</resource>
</resources>
</build>
在Spring Boot配置文件中添加配置
#配置mapper xml文件的路径
mybatis-plus.mapper-locations=classpath:com/guli/edu/mapper/xml/*.xml
重新打包项目会发现target目录下出现了xml文件夹