Skip to content

패키지 구조 설계#2

Merged
enjoy89 merged 5 commits intomainfrom
feature/package
Jan 12, 2026
Merged

패키지 구조 설계#2
enjoy89 merged 5 commits intomainfrom
feature/package

Conversation

@enjoy89
Copy link
Copy Markdown
Collaborator

@enjoy89 enjoy89 commented Jan 11, 2026

개요

  • 패키지 구조 설계

메인 리뷰어 지정

리뷰 시 참고 사항

  • domain은 순수 비즈니스 모델만 유지하고, JPA 엔티티 및 저장소 구현은 infrastructure로 분리하여 의존성을 격리시켰습니다.

TODO

  • 프로젝트 초기 패키지 구조 설계
  • User 관련 임시 파일 추가

References

체크리스트

  • PR 제목을 명령형으로 작성했습니다.
  • PR을 연관되는 github issue에 연결했습니다.
  • 리뷰 리퀘스트 전에 셀프 리뷰를 진행했습니다
  • 변경사항에 대한 테스트코드를 추가했습니다. 또는, 테스트 코드가 필요없는 이유가 있습니다.

관련 이슈

- infrastructure 상위 패키지 추가로 순수 도메인과 JPA 분리
@enjoy89 enjoy89 requested a review from blue000927 January 11, 2026 13:46
@enjoy89 enjoy89 self-assigned this Jan 11, 2026
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가능한 yaml로 관리되면 좋을 것 같습니다!

Comment on lines +10 to +15
@RequiredArgsConstructor
public class UserRepositoryImpl implements UserRepository {

private final JpaUserRepository jpaUserRepository;

}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UserRepository 하위에 R2dbcUserRepository, JpaUserRepository, ... 요런 구조를 생각했어요!
JPA CRUD를 위해 필요한 Interface는 JpaUserRepository 하위에 내부 클래스로 정의하면 어떨까요?

네이밍은 하기 나름인데 어차피 내부에서만 쓰는 클래스니까 UserRepositoryAdapter 요런 네이밍을 쓰셔도 되고 좀 자유롭습니다.

저랑 같이하셨던 멘티분은

  • domain: UserRepository
  • infra
    • JpaUserRepository implements UserRepository
    • UserEntityRepository extends JpaRository<UserEntity, Long> (JpaUserRepository 하위)

요렇게 네이밍 지었었습니다!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아, 이해했습니다! 제안해주신 방법 도메인 순수성 유지 측면에서 좋은거같습니다. 네이밍은 UserEntityRepository로 수정하고, 내부로 정의해서 반영하겠습니다~

Comment on lines +3 to +4
public interface UserRepository {
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(참고) 여기에 추후 infra crud에서 활용될 인터페이스 명세가 들어감

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

또한 여기는 도메인 interface이므로 crud 파라미터와 응답 타입은 도메인 타입이 됩니다.
가령, public User save (User user) 요런 형태입니다.

따라서 infra 레이어에서 도메인 -> 엔티티, 엔티티 -> 도메인 바꾸는 과정이 생깁니다.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enjoy89 enjoy89 merged commit 52b9d39 into main Jan 12, 2026
1 check passed
@enjoy89 enjoy89 deleted the feature/package branch March 4, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

패키지 구조 설계

2 participants