-
RestTemplate
makes interacting with most RESTful services a one-line incantation. And it can even bind that data to custom domain types. - 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. - 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 aPage
object. From there, the contents of thePage
object will be printed to the console.Here you’ve only usedRestTemplate
to make an HTTPGET
request. ButRestTemplate
also supports other HTTP verbs such asPOST
,PUT
, andDELETE
. - http://spring.io/guides/gs/consuming-rest/
Apart from coding and design interview questions, this page contains updates on my learnings with Java. It helps me organize my learning. Read about my future self here : https://siliconvalleystories.blogspot.com/
Sunday, 3 August 2014
Consuming REST Services using Spring
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment