ResponseEntity
@RequestMapping("/test1")
public ResponseEntity<?> testControllerAdvice(String id) {
if (StringUtils.isEmpty(id)) {
throw new UserNotExistException(id);
}
//能设置返回的状态码,和请求头 可以拆解为@ResponseBody和@ResponseStatus
return new ResponseEntity<String>("正常", HttpStatus.BAD_REQUEST);
}