本文共 625 字,大约阅读时间需要 2 分钟。
首先肯定还是引入mybatis依赖
org.mybatis.spring.boot mybatis-spring-boot-starter 1.2.0
在启动类处扫描mybatis的mapper类

写一个mapper接口类
定义好查询方法
在resources下编写mapper接口类对应的xml文件

在yml中配置,可以扫描到xml文件
mybatis: mapper-locations: classpath:mapper/*.xml #配置mybatis扫描mapper文件xml的路径

转载地址:http://wjizz.baihongyu.com/