查看@ExceptionHandler
你可以像这样使用它
@ExceptionHandler(IOException.class)@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)public void handleExc(IOException ext) {}那将捕获控制器方法抛出的所有IOException,并向响应写出500。

查看@ExceptionHandler
你可以像这样使用它
@ExceptionHandler(IOException.class)@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)public void handleExc(IOException ext) {}那将捕获控制器方法抛出的所有IOException,并向响应写出500。