记录一下springboot+mybatisplus项目启动时遇到Property ‘mapperLocations’ was not specified的解决方法。
两步解决:
第一步,在pom.xml中添加如下代码
<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>
第二步,在yml配置文件中加上如下配置:
mybatis-plus:
configuration:
#控制台打印完整带参数SQL语句
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
call-setters-on-nulls: true
# 这里根据自己项目的包修改,扫描到自己的*xml文件
mapper-locations: classpath:xx/xx/xx/**/mapper/*.xml
通过这两步的配置,成功解决了我的问题