如何在spring-boot中设置hibernate.format_sql?

问题描述:

我正在使用 spring-boot 自动配置进行数据库注入,并定义了属性:

I'm using spring-boot autoconfiguration for database injection, with properties defined:

spring.jpa.database=POSTGRESQL
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update

但是如何设置 hibernate.format_sql = true ?春季启动不支持吗?

But how can I set the hibernate.format_sql=true? Is that not supported by spring boot?

Spring Boot将允许您使用以下命令设置任何可用的hibernate属性:

Spring Boot will let you set any available hibernate property using:

spring.jpa.properties。*

所以 spring.jpa.properties.hibernate.format_sql = true 也可以。

查看这个部分文档