Pages

Sunday, 3 August 2014

Consuming REST Services using Spring


  1.  RestTemplatemakes interacting with most RESTful services a one-line incantation. And it can even bind that data to custom domain types.
  2. As you can see, this is a simple Java class with a handful of properties and matching getter methods. It’s annotated with @JsonIgnoreProperties from the Jackson JSON processing library to indicate that any properties not bound in this type should be ignored.
  3. Because the Jackson JSON processing library is in the classpath, RestTemplate will use it (via a message converter) to convert the incoming JSON data into a Page object. From there, the contents of the Page object will be printed to the console.
    Here you’ve only used RestTemplate to make an HTTP GET request. But RestTemplatealso supports other HTTP verbs such as POSTPUT, and DELETE.
  4. http://spring.io/guides/gs/consuming-rest/

No comments:

Post a Comment