feat: EgovPropertyService 를 Spring Environment 에 편입하는 EgovServicePropertySource 추가 - #421
Open
comghost wants to merge 1 commit into
Open
Conversation
…ertySource 추가 EgovPropertyService 로 읽는 프로퍼티는 Spring Environment 와 연결되어 있지 않아 @value 나 플레이스홀더에서 보이지 않는다. 같은 값을 두 곳에서 따로 관리하거나, 서비스를 주입받아 직접 getString() 을 호출해야 한다. - EgovServicePropertySource: EnumerablePropertySource 구현. 조회는 EgovPropertyService.getString(name, null) 로 위임해 없는 키는 null 을 돌려주고 다음 PropertySource 로 넘어가게 한다. 키 목록은 getKeys() 로 만든다 - Environment 의 PropertySources 에 등록하면 @value("${...}") 와 resolvePlaceholders 에서 EgovPropertyService 값을 쓸 수 있다. 같은 서비스 인스턴스를 위임 조회하므로 refreshPropertyFiles() 로 다시 읽은 값이 그대로 보인다 EgovServicePropertySourceTest 4건 추가 — 조회와 미존재 키의 null, 키 목록, Environment 편입 후 플레이스홀더 해석, refresh 반영, 타입 변환.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
수정 사유 Reason for modification
수정된 소스 내용 Modified source
배경
EgovPropertyService로 읽는 프로퍼티는 SpringEnvironment와 연결되어 있지 않습니다. 그래서 같은 값을@Value나플레이스홀더에서 쓰려면 properties 를 두 곳에 두거나, 서비스를 주입받아
getString()을 직접 호출해야 합니다.DB 프로퍼티(
DbPropertySourceDelegate)는Environment에 편입되는데 파일 기반 서비스 값만 빠져 있는 셈입니다.추가한 것
EgovServicePropertySource—EnumerablePropertySource<EgovPropertyService>구현EgovPropertyService.getString(name, null)로 위임합니다. 없는 키는 예외 대신null을 돌려줘 다음PropertySource 로 넘어가게 합니다(PropertySource 계약).
getKeys()로 만들어 열거형 PropertySource 로 동작합니다.Environment의 PropertySources 에 등록하면@Value("${Globals.DbType}")와resolvePlaceholders에서 서비스 값을쓸 수 있고,
Environment의 타입 변환(getProperty(name, Integer.class))도 그대로 적용됩니다.설계 메모
refreshPropertyFiles()로 다시 읽은 값이 재기동 없이 보입니다. 단@Value로주입된 필드는 주입 시점 값이 고정되며, 갱신 반영은
Environment를 직접 조회할 때 기준입니다(javadoc 에 명시).addLast/addFirst)는 사업이 정합니다. 시스템 프로퍼티나 다른 소스와 키가 겹칠 때의 우선순위를 그 순서로 조정할 수 있습니다.JUnit 테스트 JUnit tests
EgovServicePropertySourceTest4건 신규,fdl.property모듈 전건 통과.Tests run: 18, Failures: 0, Errors: 0, Skipped: 0Tests run: 18, Failures: 0, Errors: 0, Skipped: 0null, 키 목록 열거getProperty·resolvePlaceholders해석과 기본값 구문 ·Integer타입 변환refreshPropertyFiles()뒤 바뀐 값이 보이고 사라진 키는 보이지 않는다수동 확인: 현재
main(cc2b332) 위에서fdl.property모듈 빌드·테스트가 통과함을 Windows 와 Linux 에서 확인했습니다.테스트 브라우저 Test Browser
해당 없음 — 라이브러리 클래스 추가입니다.
테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video
해당 없음 — 위 JUnit 테스트 결과로 갈음합니다.
base:
eGovFramework:main@cc2b332(2026-09-10 fetch 기준, #366~#379 머지 후) · 단일 커밋