박시현 API 구축코드#5
Open
avocado-13 wants to merge 2 commits intoGDSC-PKNU-Official:mainfrom
Open
Conversation
coke98
reviewed
Jun 23, 2024
Contributor
coke98
left a comment
There was a problem hiding this comment.
LGTM! 데이터베이스도 이번에 연동해서 작성해주셨네요~! 추후 제대로 사용하기 위해서는 ORM 원리를 조금 더 심화적으로 다뤄봐도 좋을 것 같아요. 고생하셨습니다~!
| private boolean completed; | ||
|
|
||
| // 기본 생성자 | ||
| public Task() {} |
Contributor
There was a problem hiding this comment.
별도로 기본 생성자가 있어야하는 이유는 과연 무엇일까요?👀 답변으로 달아주세요!
| import org.springframework.stereotype.Repository; | ||
|
|
||
| @Repository | ||
| public interface TaskRepository extends JpaRepository<Task, Long> { |
Contributor
There was a problem hiding this comment.
jpa와 h2 데이터베이스를 사용하셨네요~!👍
jpa에서 Repository 어노테이션은 어떤 역할들을 수행하고 있을까요?
coke98
reviewed
Jun 23, 2024
| public class TaskController { | ||
|
|
||
| @Autowired | ||
| private TaskRepository taskRepository; |
Contributor
There was a problem hiding this comment.
필드에 바로 @Autowired 어노테이션만 쓰는 것 보다, 생성자를 통한 주입 방식을 쓰는 편을 더 권장하곤 합니다. 어떤 이유인지 확인 후 답변으로 남겨주시면 다른 분들도 참고할 수 있을 것 같아요
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TaskController는 할 일의 생성, 조회, 삭제를 담당합니다.
UserController는 사용자의 생성과 조회를 담당합니다.