Spring Rest Client Exception Handling

后端 未结 2 456
暖寄归人
暖寄归人 2021-02-08 11:09

I am using spring RestTemplate to consume rest services(exposed in spring rest). I am able to consume success scenarios. But for negative scenarios, service returns

2条回答
  •  走了就别回头了
    2021-02-08 11:31

    I found solution. HttpClientErrorException worked for me.

    It has e.getResponseBodyAsString() function which returns ResponseBody.

提交回复
热议问题