Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在spring boot中设置hibernate.format_sql?_Java_Spring_Spring Boot_Spring Data Jpa - Fatal编程技术网

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