最近自己搭建springboot项目整合mybatis-plus,利用代码生成器生成的xml文件位于mapper/xml包下,启动项目时老是报Property 'mapperLocations' was not specified,大意是mapperLocations属性未指定,运行时报如下错误:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
包结构如下:
解决方案
mybatis-plus: mapper-locations: classpath:com/jc/**/*.xml
同时pom文件的build添加如下信息
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**.*</include> </includes> </resource> </resources> </build>