RestTemplate: exchange() vs postForEntity() vs execute()

前端 未结 4 1862
说谎
说谎 2021-02-02 12:36

I am working on Rest API using Spring boot and I had to access an application\'s endpoint. I used RestTemplate for it. I was able to do it using 2 methods,

4条回答
  •  离开以前
    2021-02-02 13:06

    If you look at the implementation of both postForEntity and exchange method you will see that both use the execute methods in the back. Using the exchange method will give you more freedom for calling different http methods.

提交回复
热议问题