Tar*_*mid 2 java exception nullpointerexception spring-boot
我正在使用Spring Boot 2.3.1,我尝试进行自定义ExceptionHandler,
这是我的CustomHandler课:
@ControllerAdvice()
public class AppExceptionHandler extends ResponseEntityExceptionHandler{
@ExceptionHandler(value = {Exception.class, RuntimeException.class, NullPointerException.class})
public ResponseEntity<Object> handleAnyException(Exception ex, WebRequest request){
System.out.println("===>App Exception was callled....!");
return new ResponseEntity<>(
ex, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
Run Code Online (Sandbox Code Playgroud)
我的项目结构:
我无法从这个类中得到任何响应,它似乎没有加载。
谢谢。
| 归档时间: |
|
| 查看次数: |
272 次 |
| 最近记录: |