1、maven继承spring-boot
org.springframework.boot
spring-boot-starter-parent
2.0.6.RELEASE
2、指定jdk版本和字符集
UTF-8
UTF-8
1.8
3、添加依赖
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-data-jpa
mysql
mysql-connector-java
com.alibaba
druid
1.1.10
org.projectlombok
lombok
org.apache.commons
commons-text
1.2
4、添加插件
org.springframework.boot
spring-boot-maven-plugin
5、配置src/main/resources/application.yml
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/react
username: root
password: 123456
type: com.alibaba.druid.pool.DruidDataSource
jpa:
show-sql: true
hibernate:
ddl-auto: update
database: mysql
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
6、编写启动类
package com.example.react;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ReactApplication {
public static void main(String[] args) {
SpringApplication.run(ReactApplication.class, args);
}
}
7、持久化对象类