Database application.yml for Spring boot from applications.properties

You need to treat each . character in property names as levels in the yaml file:

spring:
  jpa:
    database: POSTGRESQL
    show-sql: true
    hibernate:
      ddl-auto: create-drop
  datasource:
    platform: postgres
    url: jdbc:postgresql://localhost:5432/mydb
    username: foo
    password: bar
    driverClassName: org.postgresql.Driver

EDIT: edits have been suggested, thanks for that. The driverClassName property actually should be under spring.datasource. However, the purpose of this answer was to show how a properties file is converted into yaml format. So I have changed the driverClassName property to be at the right path, that is not part of the transformation from properties to yaml.

Leave a Comment