준준의 기록일지

[스프링부트] 패키지 구조에 대한 고민 본문

스프링

[스프링부트] 패키지 구조에 대한 고민

junjunwon 2021. 10. 29. 14:41

"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."




현재 진행하려고 하는 패키지 구조

 

문제점

- user라는 클래스를 어디에 둘지 애매하다.

   - user 클래스가 board나 login 양쪽에서 쓴다면 user클래스 위치가 애매해진다. -> domain>model>user 묶음 controller>login 묶음으로 가는건 어떤가?

피드백받은 해결 방안

- 상위 패키지를 api로 두고 레스트 컨트롤러만 따로 모아서 개발

- 각각 기능을 패키지로 쪼개서 기능 단위로 묶는 방식?

- api 패키지와 web 패키지 분리

- 타임리프로 데이터를 보내는 용도는 web 패키지 안에

- use_case와 domain은 분리하는 것이 좋다.

 

배민 기술블로그의 헥사고날 아키텍처 스타일

https://techblog.woowahan.com/5143/

DDD 패키지 구조 ( Domain - Driven - Layering )

예제 : https://github.com/citerus/dddsample-core

 

GitHub - citerus/dddsample-core: This is the new home of the original DDD Sample app (previously hosted at sf.net)..

This is the new home of the original DDD Sample app (previously hosted at sf.net).. - GitHub - citerus/dddsample-core: This is the new home of the original DDD Sample app (previously hosted at sf....

github.com

 

최근 유행한다는 클린 아키텍쳐

특이하게 gateway방식으로 JPARepository를 구현해주는 것 같다. 

당장 새 프로젝트에 사용하기엔 조금 어려워보인다.

블로그 : https://wlswoo.tistory.com/67