1
を使用していない場合は、ここに私の例外のコードは次のとおりです。ませ身体私は春の注釈を使用して例外をスローエンドポイントを持っている春の注釈@ResponseStatus
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public class MyException extends BaseApiException{
public MyException (String variable){
super("variable :"+variable+" can not be updated.");
}
}
私は、RESTエンドポイントをテストするために郵便配達を使用したとき、私正しいステータスコードで正しい結果を得る:
:{
"errorType": "MyExption",
"message": "variable : XYZ can not be updated."
}
を私は受けて体を受け取らなかったrestTemplateを使用してサービスを呼び出すしようとすると、私の問題があり、ここに私のコードです3210
ResponseEntity<Document> response;
RestTemplate restTemplate = new RestTemplate();
response = restTemplate.exchange(builder.build().encode().toUri(), HttpMethod.POST, entity, Document.class);
感謝を抽出するためにエラーハンドラを定義する必要があります! :) –