Conversation
log rotation 정책 설정
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.
기술스택
구현 내용
구현 목록
✅ API 디자인
✅ API 응답값
✅ 유효성 검사
✅ 응답 형식
✅ Custom Exception
✅ 배포
❌ Test Code
❌ API throttling
프로젝트 의존성 정리
org.springframework.boot:spring-boot-starter-weborg.springframework.boot:spring-boot-starter-data-jpaorg.mariadb.jdbc:mariadb-java-clientorg.projectlombok:lombokorg.glassfish.jaxb:jaxb-runtime:4.0.3com.fasterxml.jackson.dataformat:jackson-dataformat-xmlorg.springframework.boot:spring-boot-starter-test특별히 신경 쓴 부분
아쉬운점
구현 내용 상세
API 디자인
API 응답값
createErrorResponse() 메서드를 사용하여 모든 에러 응답을 통일
GlobalExceptionHandler에서 예외를 전역적으로 처리하여 일관성 유지
성공 응답
200 OK오류 응답
400 Bad RequestcompanyCode,startDate,endDate)가 누락된 경우400 Bad Request403 Forbidden404 Not Found유효성 검사
Custom Exception, log rotation
application.properties(기본지원)과 logback-spring.xml 중 application.properties 선택
이유 : 간단하게 설정 가능하며 다른 XML 설정이 불필요하였기 때문.
but 세부적인 로그 설정이 필요하면 logback-spring.xml을 사용할 예정
📌 설정 내용
logs/app.log응답형식
사용자가 원하는 응답 포맷을 선택할 수 있도록 쿼리파라미터를 활용하여 자동 변환 지원
💣 트러블 슈팅 💣
[문제]
/api/v1/stocks?format=xml요청 시에도 XML 응답이 나오지 않음GlobalExceptionHandler에서 정의한 커스텀 예외 처리(ErrorResponseDTO)가 무시됨[해결 방법]
application.properties에서 Spring Boot의 자동 예외 처리를 비활성화spring.mvc.problemdetails.enabled=false배포
.env
도커 이미지 : ahnsojeong/stock-api:v3
실행 명령어 : docker run -d -p 80:8080 --name stock-api --env-file .env ahnsojeong/stock-api:v3
요청 주소 : http://43.201.95.193
