反复检查发现并没有什么错
原本代码:
<property name="mapperLocations" value="classpath:mapper/*.xml" />
在classpath后面加个*号就好了,这个地方真是巨TM坑
<property name="mapperLocations" value="classpath*:mapper/*.xml" />
在pom.xml加上如下配置
<!-- resources若不配置,可能会发送打包不全-->
<resources>
<resource>
<!--需要打包的目录-->
<directory>src/main/java</directory>
<!--目录中的文件类型-->
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
我的工程结构: