Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

application.properties to application.yml spring boot

I'm using bootstrap.properties to access the settings I have in github. I have a postgres database with a data.sql file in / sources that inserts some entries into the database. if I use the application.properties file in github with the following configuration:

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

Works.

However if I use applicaition.yml with the following configuration:

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

No information is entered. Could someone help?

like image 872
Rodrigo Batista Avatar asked Sep 06 '25 02:09

Rodrigo Batista


1 Answers

Need to add double quotes for application.yml

for example:

spring:
  profiles.actives: "development"
  jpa: 
    properties:
      hibernate:
        formatSql: true
        jdbc:
          lob:
            non-contextual-creation: true
    databasePlatform: "org.hibernate.dialect.PostgreSQL9Dialect"
    show-sql: false 

yaml syntax documentation

like image 51
Jonathan JOhx Avatar answered Sep 07 '25 22:09

Jonathan JOhx