spring boot全局异常处理

 时间:2024-10-11 22:30:11

1、通过intellij idea创建spring boot项目,如下图所示

spring boot全局异常处理

3、创建一个测试controller方法,然后返回异常,代码如下@RestController@RequestMapping("/test")public class TestController { @RequestMapping("") public Map test(@RequestBody Map map) throws Exception { if (1==1){ throw new Exception("1111111111"); } return map; }}

spring boot全局异常处理

5、启动程序,访问rest接口

spring boot全局异常处理
  • 虚拟机安装veket7.9操作系统
  • jenkins安装git报错no such executable in PATH
  • IDEA文件查找功能Enter file name失效 红色
  • linux自动同步时间的方法
  • 热门搜索
    螺髻山旅游攻略 香山公园旅游攻略 五台山旅游团 黄石旅游攻略 内蒙古赤峰旅游景点 合肥到黄山旅游攻略 南海影视城旅游攻略 适合春季旅游的地方 昆明旅游景点有哪些 北朝鲜旅游