我正在开发一个 spring boot 项目,并使用带有 Hibernate 的 spring data jpa 作为 JPA 实现。
目前在我的 application.yml 我有以下属性,
spring:
jpa:
show-sql: true
properties:
hibernate:
format_sql: true
generate_statistics: true
hibernate:
ddl-auto: none
dialect: org.hibernate.dialect.H2Dialect
有不同前缀的 Hibernate 属性( spring.jpa.properties.hibernate
和 spring.jpa.hibernate
)
有这些差异的目的是什么,它们可以互换使用,这意味着我可以用 spring.jpa.properties.hibernate.format_sql
替换 spring.jpa.hibernate.format_sql
吗?
为简化起见,确切地说,只有约定。只关心
value
的key
。或者
是相同的。
有关更多信息,您可以查看 https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-configure-jpa-properties
https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-configure-hibernate-naming-strategy 只是为了方便记忆。
(来源: https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-configure-jpa-properties )