我有一个工作的Spring Boot应用程序连接到Postgres数据库.我已经使用application.properties文件设置了项目,但是想要切换到application.yml文件.但是,当我进行切换时,我的应用程序在尝试连接到数据库时出错.
原始的applications.properties文件:
spring.jpa.database=POSTGRESQL
spring.datasource.platform=postgres
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.database.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=foo
spring.datasource.password=bar
Run Code Online (Sandbox Code Playgroud)
这是我在application.yml文件中到目前为止所做的:
spring.jpa:
database: POSTGRESQL
hibernate.ddl-auto: create-drop
show-sql: true
spring.datasource:
platform: postgres
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/mydb
username: foo
password: bar
Run Code Online (Sandbox Code Playgroud)
我在文件类型之间的翻译中遗漏了什么吗?