全部 我想使用@ResponseStatus向客户端返回一条消息,流程:
@ExceptionHandler(value = { Exception.class })
@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "not found mapping please check url")
@ResponseBody
public RestResponse<String> accessDenied() {
RestResponse<String> restResponse = new RestResponse<String>();
restResponse.setFailureMessageCn("xxxx");
restResponse.setFailureMessagePt(messageSource.getMessage(
"cemetery.operationFailed", null, LocaleUtils.toLocale("pt")));
restResponse.setSuccess(false);
restResponse.setBody(null);
return restResponse;
}
但它无法正常工作。 谢谢!