Spring全局异常捕捉类 注解@ControllerAdvice


package
com.sicdt.sicsign.web.bill.controller; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import com.sicdt.sicsign.bill.api.model.ModelAndResult; @ControllerAdvice public class ExceptionInterceptorHandler { @ExceptionHandler(RuntimeException.class) @ResponseBody public ModelAndResult interceptRuntimeException(Exception e){ return new ModelAndResult(false, "拦截到异常"); } }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
  • 2021-10-28
  • 2022-12-23
  • 2021-06-14
猜你喜欢
  • 2022-12-23
  • 2022-01-15
  • 2021-11-17
  • 2021-05-21
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案