1.springboot的初始化
可以在idea里面直接创建,也可以在线创建(https://start.spring.io/),没什么好说的,记得jdk版本不要选错就ok了
P:maven可以使用阿里云镜像,速度更快
<repositories><!-- 代码库 -->
<repository>
<id>maven-ali</id>
<url>http://maven.aliyun.com/nexus/content/groups/public//</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
2.MySQL
直接使用phpstudypro+navicat,简单方便
3.Mybatis-plus
首先配置数据库信息
spring.datasource.username=root
spring.datasource.password=030422
spring.datasource.url=jdbc:mysql://localhost:3306/web?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
引入依赖
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1.tmp</version>
</dependency>
然后编写实体类及mapper,并为启动类添加注解@MapperScan
注意Mybatis-plus与Mybatis不可同时引入,会产生冲突