Return to site

🍃🎓 SPRING CERTIFICATION QUESTION: What are the advantages of the RestTemplate?

· java,vcp,spring

1) Possibility to specify a different 🔀 HTTP library that RestTemplate will use.

2) High ☝️ level API with lots of convenient methods: 'RestTemplate#getForObject', 'RestTemplate#postForLocation', etc.

3) Support URI templates 📝 and URI template variables (specified within curly braces, e.g. /{name}).

4) URIs are automatically encoded ⚙️ (e.g. /hotel list will be encoded to /hotel%20list).

5) Automatic conversion 🔄️ of raw content to Java types using 'HttpMessageConverter' message converters.

6) Automatic classpath scan 🕵️‍ and registration of available 'HttpMessageConverter' message converters.

7) No need 💁‍♀️ to explicitly specify 'Content-Type' and 'Accept' headers, they are populated automatically by 'HttpMessageConverter'.

8) Support of 'JsonView'. 🔍

9) Convenient methods to build multipart ⛓️ requests using 'MultipartBodyBuilder'.

#spring #certificationquestion #vcp