[Spring] ResponseStatus어노테이션

[Spring] ResponseStatus어노테이션

import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpStatus;
위의 것들을 import하고

@ResponseStatus(code = HttpStatus.NOT_FOUND, reason = "Directory Not Found")
public class DirectoryNotFoundException extends RuntimeException {
}
위와 같이 만들고 나서


throw new DirectoryNotFoundException();
이렇게 처리하면 됨

댓글

이 블로그의 인기 게시물

[소프트웨어공학] NS(Nassi-Schneiderman) 차트

[운영체제] 파일의 구조(순차 파일, 직접 파일, 색인 순차 파일)

[운영체제] MLQ & MFQ