[1주차] 최유찬/[feat] 초기 프로젝트 설정 #40
Merged
ruchan04 merged 2 commits intoLeets-Official:최유찬/mainfrom Mar 26, 2026
Hidden character warning
The head ref may contain hidden characters: "\ucd5c\uc720\ucc2c/1\uc8fc\ucc28"
Merged
Conversation
LGH0507
reviewed
Mar 26, 2026
|
|
||
| @RestController | ||
| @RequiredArgsConstructor | ||
| public class ApiController { |
There was a problem hiding this comment.
코드 작성하시느라 고생하셨습니다😄 하지만 ApiController, 하나의 컨트롤러에서 헬스체크와 문자열 반복이라는 두가지 책임을 동시에 가짐에 있어서 SRP(단일책임원칙)과 잘 맞지 않은 것 같습니다. HealthController와 RepeatController로 나누어 각각 한 가지 책임을 위임하는 방식으로 리팩토링하시면 더 좋은 코드가 될 것 같습니다❗
| import org.springframework.stereotype.Service; | ||
|
|
||
| @Service | ||
| public class ApiService { |
There was a problem hiding this comment.
현재 ApiService로 되어있는데 문자열 반복 서비스인만큼 서비스 네이밍도 그에 맞춰서 작성하시면 더욱 좋을 것 같습니다! 💊
| @@ -0,0 +1,10 @@ | |||
| package com.example.demo1.dto; | |||
There was a problem hiding this comment.
DTO 활용해서 요청/응답을 명확하게 잘 분리하신 것 같고, 입력값 검증과 예외 처리 부분 읽어보면서 많이 배웠습니다. 미션 진행하시느라 고생 많으셨습니다!
yeonjuncho
approved these changes
Mar 26, 2026
yeonjuncho
left a comment
There was a problem hiding this comment.
💊
.gradle/, .idea/, build/, .class 같은 로컬 빌드 산출물이 많이 포함되어 있는 것 같습니다. 이 부분 수정이외에는 좋은 것 같습니다. 고생하셨습니다!
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.
1. 과제 요구사항 중 구현한 내용
GET /health)POST /string/repeat)2. 핵심 변경 사항
Layered Architecture 적용: ApiController와 ApiService로 역할을 분리하여 유지보수성을 높였습니다.
API 경로 통일: 모든 API 엔드포인트를 /api/test/ 하위로 구성하여 가독성을 개선했습니다.
예외 처리 도입: DTO 수준에서 @NotNull Validation을 추가하여 value가 없을 경우 COMM_400 에러가 반환되도록 설정했습니다.
3. 실행 및 검증 결과
GET /health응답:POST /string/repeat요청/응답:실행 결과: Tomcat started on port 8080 확인 및 정상 작동
GET /api/test/health 응답:
JSON
{ "isSuccess": true, "code": "TEST_200", "message": "OK" }
POST /api/test/repeat 요청/응답:
요청: {"value": "hello"}
응답:
JSON
{ "isSuccess": true, "code": "TEST_201", "message": "성공", "data": { "string_one": "hello", "string_two": "hello" } }
4. 완료 사항
요청/응답 DTO 분리 및 공통 응답 규격 적용
잘못된 요청(Null)에 대한 Validation 예외 처리 구현
Controller - Service 레이어 분리 및 의존성 주입(@requiredargsconstructor) 적용
5. 추가 사항
관련 이슈: closed #16
제출 체크리스트
{이름}/main브랜치다{이름}/{숫자}주차브랜치다Reviewer 참고