Java 如何在spring boot中设置hibernate.format_sql?
我正在使用Java 如何在spring boot中设置hibernate.format_sql?,java,spring,spring-boot,spring-data-jpa,Java,Spring,Spring Boot,Spring Data Jpa,我正在使用spring bootautoconfiguration进行数据库注入,并定义了以下属性: spring.jpa.database=POSTGRESQL spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto=update 但是如何设置hibernate.format\u sql=true?spring boot不支持这一点吗?这是非常可用的 spring.jpa.hibernate.format_sql=true Spring
spring boot
autoconfiguration进行数据库注入,并定义了以下属性:
spring.jpa.database=POSTGRESQL
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
但是如何设置hibernate.format\u sql=true?spring boot不支持这一点吗?这是非常可用的
spring.jpa.hibernate.format_sql=true
Spring Boot将允许您使用以下方法设置任何可用的hibernate属性:
spring.jpa.properties.*
因此spring.jpa.properties.hibernate.format\u sql=true
也可以工作
查看您可以使用的部分文档:
spring.jpa.properties.hibernate.format\u 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