[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 {
}
public class DirectoryNotFoundException extends RuntimeException {
}
위와 같이 만들고 나서
throw new DirectoryNotFoundException();
이렇게 처리하면 됨
댓글
댓글 쓰기