2V0-72.22PSE · Question #80
The Spring RestTemplate class:
The correct answer is D. Can be used to send and receive HTTP data defined using Spring's RequestEntity and. RestTemplate supports Spring's RequestEntity and ResponseEntity types, giving you a clean way to construct outgoing HTTP requests (with headers, method, and body) and receive full HTTP responses (with status code and headers) - making D correct as written. Option A is wrong…
Question
The Spring RestTemplate class:
Options
- ACan be used for non-blocking I/O, streaming applications, or handling reactive streams back
- BRequires HttpMessageConverters to be explicitly defined for it before it can be used.
- CCan only be used to talk to applications implemented using Spring MVC or WebFlux.
- DCan be used to send and receive HTTP data defined using Spring's RequestEntity and
How the community answered
(61 responses)- A2% (1)
- B5% (3)
- C2% (1)
- D92% (56)
Explanation
RestTemplate supports Spring's RequestEntity and ResponseEntity types, giving you a clean way to construct outgoing HTTP requests (with headers, method, and body) and receive full HTTP responses (with status code and headers) - making D correct as written. Option A is wrong because RestTemplate is a synchronous, blocking client; for reactive/non-blocking use cases, Spring provides WebClient instead. Option B is wrong because RestTemplate auto-configures default HttpMessageConverters (e.g., for JSON via Jackson) out of the box - explicit definition is optional, not required. Option C is wrong because RestTemplate is a generic HTTP client that communicates with any HTTP server regardless of the server-side framework (Node.js, Django, Rails, etc.).
Memory tip: Think of RestTemplate as a blocking REST caller that speaks Spring's HTTP vocabulary - it uses RequestEntity/ResponseEntity in, blocks until the response arrives, and works with any HTTP server. When you see "reactive" or "non-blocking," think WebClient, not RestTemplate.
Topics
Community Discussion
No community discussion yet for this question.