1. 创建springboot项目,基于springboot 2.1.3 release,引入相关pom依赖,mybatis-springboot-starter,mysql 连接驱动,最终pom文件如下:springboot 2.0 整合 mybatis
  2. 配置application.yml,application.properties也是一样的配置,只是我比较喜欢yml这种结构化的方式;springboot 2.0 整合 mybatis
  3. 新建实体类;
    springboot 2.0 整合 mybatis
  4. 新建mapper接口;
    springboot 2.0 整合 mybatis
  5. 启动类上添加mapper扫描地址;
    springboot 2.0 整合 mybatis
  6. 新建xxMapper.xml,编写sql文件
    springboot 2.0 整合 mybatis
  7. 单元测试
    springboot 2.0 整合 mybatis
    Github 项目完成地址

相关文章: