标签:代码 ret hand code response handle 运行时 body bsp
未被try catch的运行时异常都会被以下代码捕获
import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.Map; @ControllerAdvice public class EEcontroller { @ExceptionHandler(RuntimeException.class) @ResponseBody public Map<String,String> errorInfo(){ Map<String,String> map=new HashMap<>(); map.put("code","500"); return map; } }
标签:代码 ret hand code response handle 运行时 body bsp
原文地址:https://www.cnblogs.com/hhxylm/p/11118408.html