try catch

    [Springboot] 블로그 만들기 (13)_Delete 테스트, Exception처리

    DB insert test를 하다가 망가진 1번 데이터를 Delete해보자 Controller @DeleteMapping("/dummy/user/{id}") public String DeleteUser(@PathVariable int id) { userRepository.deleteById(id); return "삭제되었습니다 Id : " + id; } 결과 확인 매우 간단하게 delete 문을 작성할 수 있다. 하지만 이 방법은 조금 위험하다. 만약에 존재하지 않는 값 5를 넣어준다면 ? 위와 같이 오류가 발생하게 된다. --> Exception (예외) 처리를 해야된다. @DeleteMapping("/dummy/user/{id}") public String DeleteUser(@PathVariable..