//处理器里的处理方法
@RequestMapping("/testResponseStatusExceptionResolver")
public String testResponseStatusExceptionResolver(@RequestParam("i") int i){
if(i==3){
throw new TestException(); //抛出一个自定义的异常
}
return "success";
}
//使用@ResponseStatus标注自定义异常类
@ResponseStatus(value=HttpStatus.FORBIDDEN, reason="This is a exception for test")
public class TestException extends RuntimeException {
}