javaspringspring-bootspring-data-jpa

How to set hibernate.format_sql in 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

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


Solution

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

    spring.jpa.properties.*

    So spring.jpa.properties.hibernate.format_sql=true would work as well.

    Check out this part of the documentation