Skip to content
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

♻️ refactor: 설문조사 내부 로직 수정 (#59) #63

Merged
merged 7 commits into from
May 24, 2024

Conversation

jinho7
Copy link
Contributor

@jinho7 jinho7 commented May 23, 2024

☝️Issue Number

🔎 Key Changes

  • 설문조사 내부 로직 수정
    1cfd4c1

💌 To Reviewers

  • 주의사항

@jinho7 jinho7 self-assigned this May 23, 2024
@jinho7 jinho7 linked an issue May 23, 2024 that may be closed by this pull request
1 task
@jinho7 jinho7 changed the title ♻️ refactor: 설문조사 내부 로직 수정 ♻️ refactor: 설문조사 내부 로직 수정 (#59) May 23, 2024


@UtilityClass
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

유틸리티 클래스에 대해 인스턴스화(객체 생성)를 방지하기 위해 생성자를 private으로 선언하려고 했습니다.
유틸리티 클래스는 주로 정적 메서드로만 구성되며, 객체 상태를 가지지 않기 때문에 이러한 어노테이션을 찾아봤습니다.

저도 찾아서 써본 건데, 해당 글 참고해보니 오히려 단점도 있는 어노테이션 이네요...
평소 쓰던대로 @NoArgsConstructor(access = AccessLevel.PRIVATE) 로 바꾸겠습니다.

@CollectionTable(name = "setting_days", joinColumns = @JoinColumn(name = "setting_id"))
@Column(name = "day")
@Enumerated(EnumType.STRING)
private Set<DayOfWeek> days = new HashSet<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 궁금했는데~ 잘 쓰셨네요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

굿


import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@RestControllerAdvice
@ControllerAdvice
Copy link
Contributor

Choose a reason for hiding this comment

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

@ControllerAdvice + @ReseponseBody = @RestControllerAdvice 인 걸로 알아서 @ControllerAdvice 만 쓰면 예외 제대로 안 던져졌던 거 같은데 ~ 혹시 바꾸신 이유가 있으신가요 ?

참고: https://medium.com/sjk5766/restcontrolleradvice-vs-controlleradvice-%EC%A0%95%EB%A6%AC-1591010ce0b0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

죄송합니다.

@jinho7 jinho7 merged commit 8508c91 into develop May 24, 2024
@jinho7 jinho7 deleted the feature/#59 branch May 24, 2024 05:53
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.

♻️ refactor: 설문조사 내부 로직 수정
2 participants