Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file modified keyword/.DS_Store
Binary file not shown.
11 changes: 9 additions & 2 deletions keyword/chapter07/keyword.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- `@AllArgsConstructor`: 모든 필드를 파라미터로 받는 생성자 자동으로 생성
- `@JsonPropertyOrder`: JSON 직렬화 시 필드의 출력 순서를 지정
- `@JsonInclude(JsonInclude.Include.NOT_NULL)`: null인 필드를 JSON에 포함하지 않도록 한다

- `RequiredArgumentConstructor`: (가장 많이쓴다)final

### Builder
builder(): (복습)빌더패턴 구현 메서드, 클래스에 대한 빌더 인스턴스를 반환하여 유연하게 객체를 생성할 수 있게 한다.
Expand Down Expand Up @@ -36,4 +36,11 @@ vaildation(유효성검증): 데이터가 특정 조건을 만족하는지 확

작동방식 : 컴파일 시 바이트코드를 조작하여 자동으로 메서드를 추가하는 방식이기 때문에 실제 코드 파일에는 나타나지 않고, 컴파일된 클래스 파일에 생성된다.

첫줄에서 정리해둔 어노테이션의 대부분이 Lombok 라이브러리에 속한다.
첫줄에서 정리해둔 어노테이션의 대부분이 Lombok 라이브러리에 속한다.


`public ApiResponse<TempResponse.TempTestDTO> testAPI(){`

응답 DTO를 ApiResponse로 감싸서 전달

컨버터의 역할: 데이터를 다른 형식의 객체로 변환하여 반환, 엔티티를 컴퓨터가 원하는 DTO로 바꿔주려고 사용한다.
33 changes: 33 additions & 0 deletions keyword/chapter08/keyword.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
내용 정리

- converter: 타입 변환, 데이터 바인딩, 서비스 계층에서 DTO와 엔티티간 변환을 위해 활용



Java의 Exception 종류들
1. Checked Exception
컴파일 시점에 반드시 처리해야 하는 예외로, try-catch 또는 throws를 통해 예외 처리가 강제
데이터베이스 작업이나 파일 입출력 시 자주 발생
예시: IOException, SQLException.
2. Unchecked Exception
런타임 시점에 발생하며, 처리하지 않아도 컴파일은 정상적으로 된다.
주로 프로그래밍 실수로 인해 발생하며, Null 처리와 같은 상황에서 자주 나타난다.
예시: NullPointerException, IndexOutOfBoundsException.
3. Error
시스템 레벨에서 발생하는 문제로, 일반적으로 개발자가 처리할 수 없는 경우이며
메모리 부족이나 스택 오버플로와 같은 상황에서 발생한다.
예시: OutOfMemoryError, StackOverflowError.
4. Custom Exception
애플리케이션 로직에 따라 개발자가 정의한 예외 클래스
Exception이나 RuntimeException을 상속받아 구현하며, 특정 상황을 명확하게 처리 가능
@Valid
1. @Valid의 역할
@Valid는 스프링에서 객체의 유효성을 검증하기 위해 사용하는 어노테이션
입력 데이터가 유효한지 자동으로 확인하며, 주로 Controller에서 요청 데이터 검증에 사용된다
2. 유효성 검증 기본 원리
@Valid는 Bean Validation API(JSR 380)를 기반으로 동작한다
유효성 규칙이 위반되면 예외(MethodArgumentNotValidException)가 발생한다
3. 주요 유효성 검증 어노테이션
@NotNull, @Size, @Pattern, @Email, @Min, @Max 등을 사용하여 필드 조건을 명시한다
4. Custom Validation
@Constraint와 ConstraintValidator를 사용하여 커스텀 검증 규칙을 구현할 수 있다.
Binary file modified mission/.DS_Store
Binary file not shown.
Binary file added mission/chapter06/mission.pdf
Binary file not shown.
30 changes: 30 additions & 0 deletions mission/chapter07/mission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ApiResponse - 통일된 API 응답을 위한
![alt text](image-9.png)

에러 형식 DTO
![alt text](image-7.png)
![alt text](image-8.png)
에러 상태 enum
![alt text](image-5.png)
성공 상태 enum
![alt text](image-6.png)
서비스
![alt text](image-2.png)
![alt text](image-13.png)
컨트롤러
![alt text](image-3.png)
컨버터
![alt text](image-12.png)
응답 DTO
![alt text](image-4.png)
핸들러
![alt text](image-10.png)
ExceptionAdvice - `@RestControllerAdvice`를 예외처리에 적용
![alt text](image-11.png)


`/temp/test` 경로 실행 결과:
![alt text](image.png)

`/temp/exception?flag` 실행결과:
![alt text](image-1.png)
Binary file added mission/chapter07/mission.pdf
Binary file not shown.
Binary file added mission/chapter08/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter08/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mission/chapter08/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added mission/chapter08/mission.md
Empty file.