1. 创建项目
2. application.properties
server.port=8087
spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root123.
spring.jpa.database=mysql
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
3. 项目结构
4.项目源码:https://github.com/XueKX/spring-boot-notes/tree/master/spring-boot-jpa