一、知识准备
1.springboot
springboot简化了配置编写,可以快速开发web应用,已经成为java主流的开发框架。
2.vue
前端开发也进入框架时代,vue能够满足前后端开发分离的需要,快速独立构建前端应用。
3.mybatis-plus
mybatis-plus是对mybatis的扩展,在保留了mybatis灵活使用sql语句的基础上,又扩展了基本的CRUD功能调用,大大提高了开发效率,程序员不用在编写、调试基本的CRUD映射sql语句。
4.json
前后端分离后,采用json格式作为前后端数据交互标准。
5.Restful API设计规范
RESTFUL是一种网络应用程序的设计风格和开发方式,客户端使用GET、POST、PUT、DELETE4个表示操作方式的动词对服务端资源进行操作:GET用来获取资源,POST用来新建资源(也可以用于更新资源),PUT用来更新资源,DELETE用来删除资源。
二、前后端集成
1、使用Maven创建springboot项目
2、引入pom配置,添加mybatis-plus、druid、mysql依赖
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- Mysql-Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- Fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<!-- Druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
<!-- Mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<!-- Pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<gro