测试:报告异常 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):
问题分析: dao层编译后只有class文件,没有mapper.xml,因为maven工程在默认情况下src/main/java目录下的所 有资源文件是不发布到target目录下的
1.复制xml到target目录下(不推荐)
2.把xml放到resources目录下
3.推荐使用:通过配置实现
(1)pom.xml
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build>
(2)项目application.properties
#配置mapper xml文件的路径
mybatis-plus.mapper-locations=classpath:com/wtu/edu/mapper/xml/*.xml(填入自己xml路径)