如何在spring-boot中设置hibernate.format_sql?
我正在使用spring-boot
自动配置进行数据库注入,并定义了属性:
spring.jpa.database=POSTGRESQL spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto=update
但是如何设置hibernate.format_sql=true
? 弹簧靴不支持吗?
Spring Boot将允许您使用以下命令设置任何可用的hibernate属性:
spring.jpa.properties.*
所以spring.jpa.properties.hibernate.format_sql=true
也可以。
查看本文档的这一部分
您可以使用: spring.jpa.properties.hibernate.format_sql=true
除了文档之外 ,我还会从这里按照示例来配置我的应用程序。 您可以找到正在使用的属性样本。
这非常有用
spring.jpa.hibernate.format_sql=true
如果使用yml
格式声明Spring Boot属性,则可以使用:
spring: datasource: jpa: properties: hibernate.format_sql: true
jpa: hibernate: ddl-auto: update show-sql: true properties: hibernate.format_sql: true