package com.cj.system.exception; import com.cj.common.result.Result; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) @ResponseBody public Result error(){ return Result.fail().message("全局异常处理"); } }
标签:web,处理,bind,springframework,org,import,全局,异常,annotation From: https://www.cnblogs.com/cciscc/p/16837179.html