[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();
이렇게 처리하면 됨

댓글

이 블로그의 인기 게시물

[Python] # -*- coding: utf-8 -*-를 쓰는 이유

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

[컴퓨터네트워크] Telnet이란?