springboot与mybatis整合时会发现mapper文件必须放在resource下,这样对于一些人很不习惯。这样我们说一下解决办法。
**

<>application.yml的配置

**
mybatis: config-location:classpath:mybatis/mybatis.cfg.xml # mybatis配置文件所在路径
mapper-locations:classpath*:com/example/demo/**/dao/xml/*.xml # mapper映射文件
**
一定要注意classpath*

<>application.properties的配置

**
#mybatis的mapper配置文件 # mybatis配置文件所在路径
mybatis.config-location:classpath:mybatis-config.xml # 所有的mapper映射文件
mybatis.mapper-locations:classpath*:com/springboot/mapper/*.xml

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信