Repository navigation
fix: 권한 그룹 배정 목록 처리를 단일 트랜잭션으로 묶음 - #93
Merged
Merged
Conversation
jei007
approved these changes
Sep 18, 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
EgovAuthorGroupAPIController의authorGroupInsert·authorGroupDelete는 화면에서 세미콜론으로 이어 보낸 사용자 목록을 항목마다 순회하며, 각 항목에서 서비스의insert·update·delete를 직접 호출합니다.insert·update·delete는 각각@Transactional입니다.컨트롤러가 서비스 빈(프록시)의 메서드를 항목마다 호출하므로,
@Transactional은 호출마다 새 트랜잭션을 엽니다. 항목이 여러 개인 요청 중간에 예외가 나면 앞쪽 항목은 이미 커밋된 채 남고 뒤쪽 항목은 처리되지 않아, 화면이 보낸 한 번의 저장·삭제 요청이 부분적으로만 반영됩니다. 이 프로젝트는 AspectJ 로드타임 위빙을 쓰지 않아(-javaagent설정·@EnableTransactionManagement(mode=ASPECTJ)없음)@Transactional은 기본값인 프록시 기반으로 동작합니다.서비스에 배치 메서드를 추가해, 컨트롤러의 두 루프를 서비스 메서드 안으로 옮겼습니다. 프록시 기반 AOP는 같은 인스턴스 안의 자기호출(
this.insert(...)등)을 가로채지 않으므로, 안쪽 호출은 새 트랜잭션을 열지 않고 바깥 메서드가 연 트랜잭션 하나를 그대로 씁니다.컨트롤러는 이 메서드들만 호출합니다.
JUnit 테스트 JUnit tests
EgovAuthorGroupRepository를 Mockito로 스텁해EgovAuthorGroupServiceImplBatchTest를 추가했습니다.insertOrUpdateList가 항목마다 올바른 사용자·권한코드로 저장하는지(신규는 insert, 기존은 update),deleteList가 목록의 사용자 전원을 삭제하는지 확인합니다.수정 전(RED,
deleteList가 첫 항목만 처리하도록 되돌려 재현):수정 후(GREEN):
같은 모듈의 기존 테스트 2건(
EgovAuthorGroupServiceImplTest·EgovAuthorGroupInfoServiceImplTest)은@SpringBootTest로 로컬 MySQL 접속이 필요한데, 이 환경에는 그 DB가 떠 있지 않아 origin/main 기준으로도 이미 실패합니다. 이 변경과 무관합니다.테스트 브라우저 Test Browser
JUnit 테스트로 대체합니다.
테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video
위 JUnit 테스트 실행 결과로 대체합니다.