Spring Integration or Apache HTTP Client

后端 未结 3 1293
后悔当初
后悔当初 2021-01-01 23:29

I have a spring application which requires to call REST based external API calls for some data.

The data format from the API is JSON.

My question is which o

3条回答
  •  孤街浪徒
    2021-01-01 23:42

    Spring comes with a class called RestTemplate (javadoc) that should make this sort of thing easy. It hides the HTTP handling and provides a REST-style operations interface. It includes support for message converters for converting to and from JSON (in this case, Spring has support for the Jackson library).

    Spring Integration is huge overkill for this - REST is inherently simple. Commons HttpClient would work, but leaves you with extra work to do on top of that.

    See the section of the Spring docs on how to use RestTemplate, and the JSON message conversion.

提交回复
热议问题