【发布时间】:2017-03-28 17:58:13
【问题描述】:
我想在我的 Spring Boot 项目中使用 DLL 脚本初始化我的数据源(当然只在开发期间)。正如文档here 中所述,我将spring.datasource.schema 属性设置为src/main/resources/postgresql/define-schema.sql 中的DLL 脚本。
spring:
profiles: dev
datasource:
platform: postgresql
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/postgres
username: postgres
password: ****
initialize: true
schema: ./postgresql/define-schema.sql
continue-on-error: false
jpa:
hibernate:
ddl-auto: validate
generate-ddl: false
show-sql: true
但是脚本不会被执行。我还尝试将它放在类路径根目录中并将其命名为 schema.sql ... 没有任何反应。
dev 配置文件被选中,至少我在日志中看到它:The following profiles are active: dev
应用程序在 JPA 模式验证上失败。
我从休眠中得到的唯一警告:
Found use of deprecated [org.hibernate.id.SequenceGenerator] sequence-based id generator; use org.hibernate.id.enhanced.SequenceStyleGenerator instead. See Hibernate Domain Model Mapping Guide for details.
但我认为这与初始化问题无关。
我的依赖项中有 spring-boot-security-starter 但尚未配置,这可能是问题来源吗?
有没有人认出一个明显的错字,还有什么错误?
期待您的来信!
放大器
【问题讨论】:
标签: postgresql spring-boot spring-data-jpa spring-jdbc