-
Notifications
You must be signed in to change notification settings - Fork 5
2주차 : 줌터파크 과제 제출합니다. #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
minsoozz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
연재님 고생 많으셨습니다!
|
|
||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @Component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Component 와 @Service 어노테이션의 차이를 나누는 기준이 어떻게 되는지 궁굼합니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Facade 를 입사 후 처음 접하며 해당 부분에 대해서 @Component 와 @Service 중 어느 것이 적합한지에 대해 좀 더 고민해보지 못했었던 것 같습니다..!
@Component와 @Service 둘 다 클래스를 컴포넌트로 등록하고 스프링 컨테이너에서 관리할 수 있도록 해주지만,
이때 @Service의 경우 좀더 세부적인 유스케이스 들을 위하여 @Component 의 구체화된 형태로서, 해당 클래스가 비즈니스 로직을 처리하는 서비스 역할을 한다는 것을 나타내주며 AOP에서 특정 작업을 수행하기 위해 다른 어노테이션과 결합하여 사용될 수도 있다는 것을 다시 한번 상기하였습니다.
처음 Facade 에 어노테이션을 붙일 때 메인 Service가 아니니 명시적인 의미로도 @Service 보단 @Component 가 적합하지 않을까? 하고 고민하였었는데요, 제 로직을 다시 보니 비즈니스?적인 로직들이 들어가있고, 해당 부분을 바탕으로 테스트를 진행한다는 점을 보면 @Service가 더 적합하려나..? 하는 생각이 드는 것도 같습니다..!
혹시 다른 좋은 기술적 의견이나 생각이 있으시다면 알려주시면 감사하겠습니다..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Service 도 결국 @Component 를 상속받고 있어서 기술적인 차이는 없다고 생각해요.
단지 비즈니스 로직에 대한 구분 역할을 해준다고 생각합니다.
코드에 고민을 많이 하신 흔적이 보여서 연재님은 어떻게 생각하시는지 의견을 여쭈고자 질문드렸습니다!
지금 생각해보면 Facade 계층이라는 것을 직관적으로 알 수 있는 @FacadeService 같은 커스텀 어노테이션을 사용해서 직관적으로 개선 할 수도 있을 것 같아요 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 말씀과 의견 감사합니다! 추후 리팩토링에 반영하도록 하겠습니다!!😊
minsoozz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여러가지 동시성 제어 기법에 대해 테스트를 열심히 작성하셨네요~!
코드를 이해하는데 많은 도움이 되었습니다!
|
|
||
| private final TicketRepository ticketRepository; | ||
|
|
||
| private final TicketQueryDslRepository ticketQueryDslRepository; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public interface TicketRepository extends JpaRepository<Ticket, Long>, CustomTicketRepository {
}
public interface CustomTicketRepository {
}
@Repository
public class TicketQueryDslRepository implements CustomTicketRepository {
}
해당 방법처럼 기본 레포지토리를 확장하는 방법도 있습니다 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 안그래도 저번 줌근마켓에서 해당 사항으로 구현하고 리뷰해보며 궁금한 점이 있었습니다..!
혹시 민수님께서는 어떤 방법이 더 적합하다고 생각하시는지 의견을 여쭤보고 배우고 싶습니다..!🙏🏻
|
|
||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| /** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석을 꼼꼼하게 작성해주셨네요 👍
| private UserLogin userLogin; | ||
|
|
||
| @Embedded | ||
| private Orders orders; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일급 컬렉션을 활용해서 Entity를 잘 설계하신 것 같습니다!
📝 구현
🚨 이슈사항 (해결)
디버깅으로 확인해보면 Order에는 감소된 Ticket 수량이 들어가있지만, 실제 Ticket을 다시 호출하면 수량이 전혀 감소되어있지 않습니다
해당 부분 이유를 알려주신다면 감사드리겠습니다 🙏🏻
🚨 이슈사항 (Update)
해당 이슈 해결하여 고도화 진행 전 먼저 푸쉬하도록 하겠습니다.