use*_*373 5 postgresql configuration spring datasource spring-boot
我有一个 Spring Boot 应用程序,它连接到 Postgres 数据库。我已在 application.properties 中将数据源 url 指定为 -
spring.datasource.url=jdbc:postgresql://<这里的服务器IP>:5432/mydb
jdbc url (jdbc:postgresql://< server ip here >:5432/) 实际上存储在我的应用程序能够读取的单独的外部位置中。因此,我只想在属性文件中指定数据库名称。
我不想将数据库名称作为某些环境变量传递,因为它不会改变。
我已经被困在这一点上很长一段时间了,我怎样才能实现同样的目标?
将其添加到您的 application.properties 文件中
spring.jpa.hibernate.ddl-auto=create\update\none
spring.datasource.url=jdbc:postgresql://host:port/db
spring.datasource.username=username
spring.datasource.password=password
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12601 次 |
| 最近记录: |