1.用IDEA搭建
2.选择Srping initalizr
![07182303_0sCT.jpg](https://static.oschina.net/uploads/img/201710/07182303_0sCT.jpg)
3.web框架
![07182303_qw6A.jpg](https://static.oschina.net/uploads/img/201710/07182303_qw6A.jpg)
4.前端框架
![07182303_BDrY.jpg](https://static.oschina.net/uploads/img/201710/07182303_BDrY.jpg)
5.选择mysql和mybatis,点击next
![07182303_zlJ4.jpg](https://static.oschina.net/uploads/img/201710/07182303_zlJ4.jpg)
6.生成项目,选中不要的删掉
![07182303_n0vs.jpg](https://static.oschina.net/uploads/img/201710/07182303_n0vs.jpg)
7.在src/main/java 下新建Controller文件夹,新建Controller,写好注解
![07182303_eyhf.jpg](https://static.oschina.net/uploads/img/201710/07182303_eyhf.jpg)
8.建立service层
![07182303_wlvm.jpg](https://static.oschina.net/uploads/img/201710/07182303_wlvm.jpg)
9.建立mapper层
注意这里的@MAPPER
导入的包,如果运行项目,不能注入bean,可能就是导入的包错了,选择ibatis的包
这里还没有设置xml的设置,这里只是用注解的方式
![07182304_lwv9.jpg](https://static.oschina.net/uploads/img/201710/07182304_lwv9.jpg)
10.运行主方法,就可以运行了,如果不能运行,mvn clean install下,再运行
11.集成通用Mapper和分页助手
<!--mybatis,这个在生成项目的时候已经有了-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
<!--mapper-->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>1.1.4</version>
</dependency>
<!--pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.1</version>
</dependency>
mapper层继承extends
![07182304_Zm0P.jpg](https://static.oschina.net/uploads/img/201710/07182304_Zm0P.jpg)
12.测试通用mapper和分页助手
![07182304_XgZi.jpg](https://static.oschina.net/uploads/img/201710/07182304_XgZi.jpg)
![07182304_PMo4.jpg](https://static.oschina.net/uploads/img/201710/07182304_PMo4.jpg)
通用mapper:https://github.com/abel533/MyBatis-Spring-Boot
是看springboot 集成通用mapper的教程