Closed BenanaH closed 1 year ago
我在此处假设抛出了一个业务异常
/**
* 获取部门列表
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
if (1==1){
throw new ServiceException("异常");
}
List<SysDept> depts = deptService.selectDeptList(dept);
return success(depts);
}
那么当请求此接口的时候HTTP响应状态码应当为500,并且包含异常JSON响应信息
然而浏览器获得的HTTP响应状态码依然为200
在使用@RestControllerAdvice的时候应该显示标记@ResponseStatus来规定状态码