Hibernate application.properties到application.yml spring boot
我正在使用bootstrap.properties访问github中的设置。 我有一个postgres数据库,在/sources中有一个data.sql文件,可以在数据库中插入一些条目。 如果我使用github中的application.properties文件进行以下配置:Hibernate application.properties到application.yml spring boot,hibernate,spring-boot,yaml,Hibernate,Spring Boot,Yaml,我正在使用bootstrap.properties访问github中的设置。 我有一个postgres数据库,在/sources中有一个data.sql文件,可以在数据库中插入一些条目。 如果我使用github中的application.properties文件进行以下配置: spring.datasource.url=jdbc:postgresql://localhost:5432/zeus spring.datasource.username=postgres spring.datasour
spring.datasource.url=jdbc:postgresql://localhost:5432/zeus
spring.datasource.username=postgres
spring.datasource.password=postgres
# JPA Hibernate properties
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.datasource.initialization-mode=always
spring:
profiles.actives: development
jpa:
properties:
hibernate:
formatSql: true
jdbc:
lob:
non-contextual-creation: true
databasePlatform: org.hibernate.dialect.PostgreSQL9Dialect
show-sql: false
hibernate:
ddlAuto: create-drop
naming:
implicitStrategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
datasource:
platform: postgres
url: jdbc:postgresql://localhost:5432/zeus
username: postgres
password: postgres
driverClassName: org.postgresql.Driver
initialization-mode: always
工作
但是,如果我将application.yml与以下配置一起使用:
spring.datasource.url=jdbc:postgresql://localhost:5432/zeus
spring.datasource.username=postgres
spring.datasource.password=postgres
# JPA Hibernate properties
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.datasource.initialization-mode=always
spring:
profiles.actives: development
jpa:
properties:
hibernate:
formatSql: true
jdbc:
lob:
non-contextual-creation: true
databasePlatform: org.hibernate.dialect.PostgreSQL9Dialect
show-sql: false
hibernate:
ddlAuto: create-drop
naming:
implicitStrategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
datasource:
platform: postgres
url: jdbc:postgresql://localhost:5432/zeus
username: postgres
password: postgres
driverClassName: org.postgresql.Driver
initialization-mode: always
没有输入任何信息。
有人能帮忙吗?需要为application.yml添加双引号 例如:
spring:
profiles.actives: "development"
jpa:
properties:
hibernate:
formatSql: true
jdbc:
lob:
non-contextual-creation: true
databasePlatform: "org.hibernate.dialect.PostgreSQL9Dialect"
show-sql: false