链接 🔗
- MVNRepository
安装
添加依赖:<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId><version>2.2.1.RELEASE</version></dependency>
配置
### 必要配置# MySQL 配置spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource.url=jdbc:mysql://localhost:3306/examplespring.datasource.username=rootspring.datasource.password=root### 增强配置# 配置 jpa 如何更新数据库,默认 nonespring.jpa.hibernate.ddl-auto=none# 配置 jpa mysql 语句打印,默认 falsespring.jpa.show-sql=true# 配置是否格式化 sql 语句后打印spring.jpa.properties.hibernate.format_sql=true# 配置是否打印 sql 语句中的绑定参数logging.level.org.hibernate.type.descriptor.sql.BasicBinder=trace
