package com.fuwo.headline.common.exception; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import java.io.IOException; @ControllerAdvice public class ExceptionController { @ExceptionHandler(SystemException.class) public ResponseEntity<Object> handleDataNotFoundException(SystemException ex, WebRequest request) throws IOException { return new ResponseEntity<Object>( "ok", new HttpHeaders(), HttpStatus.OK); } }
springboot 异常捕获
最新推荐文章于 2020-12-07 14:52:49 发布