2016-11-15 1 views
1

스프링 부트 프로젝트에서 DLL 스크립트로 데이터 소스를 초기화하고 싶습니다 (물론 개발 과정 중에 만). 문서 here에서 언급했듯이 에있는 DLL 스크립트에 spring.datasource.schema 속성을 설정했습니다.스프링 부트 JPA 스키마 초기화

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-startter가 있지만 아직 구성되지 않았습니다. 문제가 될 수 있습니까?

누구나 잘못 알고있는 오타를 인식합니까?

앞으로 당신을 기다리십시오!

앰프

답변

0

접두사 classpath

예와 SQL 스크립트의 경로 :

spring.datasource.schema=classpath:/postgresql/define-schema.sql 
관련 문제