문정현
ExceptionHandler를 사용한 응답 메세지 전송
유효성 검증에서 통과하지 못한 경우 발생되는 MethodArgumentNotValidException을 ExceptionHandler를 통해 catch하여 에러 메세지에 대한 내용을 응답으로 확인할 수 있다.
@RestControllerAdvice public class ControllerAdvice { //유효성 검증이 실패한 경우 발생하는 exception @ExceptionHandler({MethodArgumentNotValidException.class}) public ResponseEntity handleValidException(MethodArgumentNotValidException exception) { //제약 조건 내 개발자가 기록한 message를 가져온다. String errorMessage = exception.getBindingResult().getAllErrors().get(0).getDefaultMessage(); return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(errorMessage); } }
이번 썸머 인턴 코딩 SQL문과 유사한 문제인 레벨 4의 sql 문제로 한번 풀어보시길 추천합니다.
@GetMapping의 name과 value의 차이
value는 아노테이션이 붙은 컨트롤러가 동작하는 path(url)에 대한 정보를 작성하고 name은 해당 매핑 아노테이션에 대한 명칭을 표기하는 속성이다.
정해민
최지훈
최현웅


![[Spring] Entity 수정은 변경 감지를 활용하자](https://www.notion.so/image/https%3A%2F%2Fvelog.velcdn.com%2Fimages%2Fkoo8624%2Fpost%2F163fc41c-94a4-4a67-9fce-d30a6dab930c%2Fimage.png?table=block&id=4a000569-a3af-45fc-84cb-e43425a99a55&cache=v2)


![[Spring Data JPA] No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call 에러 해결](https://www.notion.so/image/https%3A%2F%2Ft1.daumcdn.net%2Ftistory_admin%2Fstatic%2Fimages%2FopenGraph%2Fopengraph.png?table=block&id=8c5e356e-28fa-4d6f-abd3-cf432a56eda7&cache=v2)