搭建环境:
- idea2019
- maven 3.6.1
- mybatis plus
- spring boot
- mysql jdk 1.8
第一步 创建spring boot 项目
file->new->project,如图操作
点击 next
选择自己的jdk版本
点击next
设置自己的项目名和路径 点击finish
到这 spring boot 项目就创建完成了
第二步 整合mybatisplus
首先在resources文件夹下创建application.yml文件,添加以下代码
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/数据库名?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: 数据库用户名
password: 密码
在pom.xml文件中添加依赖
<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>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot