-
Notifications
You must be signed in to change notification settings - Fork 0
[Release] v1.0.2 – ADMIN 계정 생성 오류 fix #142
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
Conversation
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.
Summary of Changes
Hello @Ogu1208, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
이 PR은 관리자 계정 생성 시 발생할 수 있는 오류를 수정하고, 계정 초기화 로직의 안정성을 개선하기 위한 변경 사항을 포함합니다. 주요 변경 사항은 의존성 주입 방식과 트랜잭션 관리 범위를 조정하는 것입니다.
Highlights
- ADMIN 계정 생성 오류 수정: 관리자 계정 생성 시 발생할 수 있는 오류를 수정했습니다.
- 의존성 주입 방식 변경:
AdminAccountInitializer클래스에서@RequiredArgsConstructor를 제거하고, 필드 주입 대신 생성자 주입 방식을 사용하여 의존성을 명시적으로 관리하도록 변경했습니다. - 트랜잭션 범위 조정: 클래스 레벨에 적용되어 있던
@Transactional어노테이션을run메서드로 이동하여 트랜잭션의 범위를 해당 초기화 로직으로 한정했습니다. - 관리자 계정 생성 로직 간소화: 관리자 계정 생성 및 저장 로직을 더 간결하게 표현했습니다.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
이 PR은 @Value 프로퍼티에 대해 생성자 주입을 사용하도록 변경하여 관리자 계정 생성 오류를 수정한 점이 좋습니다. 이는 버그를 해결하고 코드의 안정성을 높이는 올바른 접근 방식입니다. 리뷰 과정에서 몇 가지 개선점을 발견했습니다. 관리자 계정 생성 시 로그가 누락된 부분과, 프로젝트 스타일 가이드에 따라 엔티티 생성에 정적 팩토리 메서드를 사용하는 것을 권장하는 내용입니다. 자세한 내용은 각 파일의 주석을 참고해주세요.
| Admin admin = new Admin(adminUsername, encodedPassword); | ||
| adminRepository.save(admin); | ||
| log.info("Admin account created: {}", adminUsername); | ||
| adminRepository.save(new Admin(adminUsername, passwordEncoder.encode(adminPassword))); |
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.
이 라인에 대해 두 가지 개선점을 제안합니다.
- 로그 기록 추가: 리팩토링 과정에서 관리자 계정 생성 시 기록되던 로그가 제거되었습니다. 관리자 계정 생성과 같은 중요한 이벤트는 보안 및 감사 추적을 위해 로그를 남기는 것이 중요합니다.
- 정적 팩토리 메서드 사용: CHERRY 프로젝트 스타일 가이드에서는 엔티티 생성 시 생성자 직접 호출 대신 정적 팩토리 메서드 사용을 권장하고 있습니다.1 이는 생성의도를 명확히 하고 관련 로직을 캡슐화하여 코드의 안정성을 높일 수 있기 때문입니다.
아래와 같이 Admin 엔티티에 정적 팩토리 메서드를 추가하고, 로그 기록을 다시 추가하는 것을 권장합니다.
Admin.java에 추가할 메서드 예시:
// Admin.java
public static Admin create(String username, String password) {
// 필요 시 username, password에 대한 유효성 검증 로직 추가
return new Admin(username, password);
} Admin admin = new Admin(adminUsername, passwordEncoder.encode(adminPassword));
adminRepository.save(admin);
log.info("관리자 계정이 생성되었습니다: {}", admin.getUsername());
관련 Issue (필수)
주요 변경 사항 (필수)
리뷰어 참고 사항
없음
추가 정보
없음
PR 작성 체크리스트 (필수)