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自动同步时间的方法
  • 热门搜索
    婴儿有痰怎么办 肉末粉条的家常做法 小儿便秘怎么办 幸福的方法读后感 网络ssid怎么填写 腰椎滑脱怎么治疗 黄页网址大全免费观看 油焖尖椒的家常做法 痤疮的治疗方法 怎么缩小咬肌