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自动同步时间的方法
  • 热门搜索
    法语我爱你怎么说 怎么查本机号码 自我介绍怎么说 惹怎么读 怎么会爱上他并决定跟他回家 羊排怎么炖好吃 微信怎么转账到银行卡 重庆大学怎么样 word下划线怎么打 干虾仁怎么做好吃