Spring Quartz 세팅 및 QRTZ_테이블관련 스키마 생성 #119
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📑 작업 내용 (Description)
지속적으로 발생하던 애플리케이션 시작 오류(
BeanCreationException,UncategorizedScriptException)를 해결하기 위해 데이터베이스 및 Quartz 스케줄러 설정을 전면적으로 리팩토링했습니다.이번 변경을 통해 애플리케이션의 메인 DataSource와 Quartz 전용 DataSource를 명확하게 분리하여, 각 스키마의 초기화가 독립적이고 안정적으로 수행되도록 구조를 개선했습니다.
📝 주요 변경 사항 (Key Changes)
DataSource 이중화 구성 (
DataSourceConfig.java추가)global/config/DataSourceConfig.java를 추가하여 두 개의 독립된DataSource빈(Bean)을 명시적으로 생성합니다.@Primary어노테이션을 지정하여 MyBatis와spring.sql.init이 사용하도록 합니다.@QuartzDataSource어노테이션을 지정하여 Spring Quartz 전용으로 사용하도록 합니다.application.yml의spring.datasource와spring.quartz.datasource설정을 각각 독립된 커넥션 풀로 관리합니다.스키마 초기화 로직 분리
spring.sql.init은 이제 메인 DataSource를 대상으로00-drop-maria.sql,01-schema.sql등 애플리케이션 관련 스크립트만 책임집니다.spring.quartz.jdbc.initialize-schema: embedded설정을 통해 Quartz가 자체적으로 스키마를 생성하도록 책임을 위임했습니다. 이 과정은 분리된 Quartz DataSource를 통해 안전하게 수행됩니다.SQL 스크립트 안정화
00-drop-maria.sql: 기존의 불안정한 동적 SQL 방식 대신, 모든 테이블을 명시적으로DROP TABLE IF EXISTS구문으로 삭제하도록 변경하여 안정성을 확보했습니다.00-truncate.sql:mode: always설정에서는 불필요하므로data-locations에서 제거했습니다.application.yml파일 정리application-develop.yml의spring.sql.init과spring.quartz설정을 명확하게 분리하고 정리했습니다.✔️ 확인 방법 (How to Verify)
develop프로파일을 활성화한 상태에서 애플리케이션을 실행합니다.BeanCreationException이나UncategorizedScriptException없이 애플리케이션이 정상적으로 시작되는지 확인합니다.workflow,user등)과 Quartz 테이블들(QRTZ_JOB_DETAILS등)이 모두 정상적으로 생성되었는지 확인합니다.✅ 체크리스트
코드 품질
테스트
배포 준비