fix: AbstractXMLUtility 가 인스턴스마다 연 설정 컨텍스트를 닫지 않던 문제 수정, 저장 경로 직접 주입 생성자 추가 - #416
Merged
Merged
Conversation
…생성자 추가 AbstractXMLUtility 의 기본 생성자는 egovxmlCfg.xml 을 읽으려고 FileSystemXmlApplicationContext 를 새로 만든 뒤 닫지 않고 필드로 보관한다. 설정에서 쓰는 값은 xmlconfig 빈의 저장 경로 하나뿐인데, 검증기(EgovDOMValidatorService· EgovSAXValidatorService)를 만들 때마다 컨텍스트가 하나씩 남아 요청마다 유틸을 만드는 코드에서는 컨텍스트가 계속 쌓인다. - 기본 생성자는 컨텍스트를 try-with-resources 로 열어 저장 경로만 읽고 바로 닫는다. 보관하던 context·xmlConfig 필드는 다른 곳에서 쓰지 않으므로 제거한다 - 저장 경로를 직접 주입받는 protected 생성자를 추가하고, 두 검증기에 같은 public 생성자를 둔다. 설정 파일과 Spring 컨텍스트 없이 쓸 수 있다. 기존 기본 생성자는 그대로다 AbstractXMLUtilityLifecycleTest 3건 추가 — 경로 주입 생성자로 컨텍스트 없이 XML 을 생성·저장하는지, 두 검증기의 경로 주입 생성자가 파싱까지 동작하는지, 기본 생성자가 종전처럼 동작하는지.
jei007
approved these changes
Sep 14, 2026
jei007
left a comment
Contributor
There was a problem hiding this comment.
표준프레임워크에 대한 지속적인 참여에
대단히 감사드립니다.
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
문제
AbstractXMLUtility의 기본 생성자는egovxmlCfg.xml을 읽기 위해 인스턴스마다FileSystemXmlApplicationContext를 새로만든 뒤 닫지 않고 필드로 보관합니다. 설정에서 쓰는 값은
xmlconfig빈의 저장 경로 하나뿐인데, 컨텍스트 전체가인스턴스 수명 동안 유지되고
close()도 호출되지 않습니다.EgovDOMValidatorService·EgovSAXValidatorService를요청마다 만드는 코드에서는 그 횟수만큼 컨텍스트(빈 팩토리·리소스 캐시·이벤트 멀티캐스터)가 쌓입니다.
또한 설정 파일 없이는 이 유틸을 만들 수 없어, 저장 경로 하나만 필요한 상황에서도 Spring 컨텍스트와
egovxmlCfg.xml을 준비해야 했습니다.수정
context·xmlConfig필드protected AbstractXMLUtility(String savedPath)신설. 두 검증기에public생성자(String savedPath)추가new EgovDOMValidatorService()등 기본 생성자호환성
private이고 클래스 안에서도 생성자 밖에서는 쓰이지 않았습니다.savedPath는 저장 API 가 파일명을 바로 이어 붙이는 기존 규칙을 따르므로 경로 구분자로 끝나야 하며, javadoc 에적었습니다(설정 값도 같은 규칙입니다).
JUnit 테스트 JUnit tests
AbstractXMLUtilityLifecycleTest3건 신규,fdl.xml모듈 전건 통과.Tests run: 6, Failures: 0, Errors: 0, Skipped: 0Tests run: 6, Failures: 0, Errors: 0, Skipped: 0ControlXMLTest·XmlUtilitySaveDocumentTest도 무변경 통과)수동 확인: 현재
main(cc2b332) 위에서fdl.xml모듈 빌드·테스트가 통과함을 Windows 와 Linux 에서 확인했습니다.테스트 브라우저 Test Browser
해당 없음 — 라이브러리 내부 수정입니다.
테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video
해당 없음 — 위 JUnit 테스트 결과로 갈음합니다.
base:
eGovFramework:main@cc2b332(2026-09-10 fetch 기준, #366~#379 머지 후) · 단일 커밋