【发布时间】:2019-04-06 12:25:50
【问题描述】:
当 Spring Boot 加载时,我需要在 Postgres 中创建一个新模式。因此,它应该检查架构是否不存在,然后创建一个新架构。 我正在使用 application.properties 进行数据库配置。
spring.datasource.platform=postgres
spring.datasource.url=jdbc:postgresql://${vcap.services.postgresql-lite.credentials.hostname}:${vcap.services.postgresql-lite.credentials.port}/${vcap.services.postgresql-lite.credentials.dbname}
spring.datasource.username=${vcap.services.postgresql-lite.credentials.username}
spring.datasource.password=${vcap.services.postgresql-lite.credentials.password}
spring.jpa.properties.hibernate.default_schema=${DATABASE_SCHEMA}
spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
Postgres 使用的默认架构是公共的,我需要更改它以创建我自己的架构,我将在 env.xml 中定义它。
【问题讨论】:
标签: spring postgresql spring-mvc spring-boot