Search code examples
restweb-servicesspring-bootresttemplate

Is it mandatory to use RestTemplate for restful web services? Or it can be ignored while giving @PostMapping with response entity in it?


In a previous project I was using rest template to call restful web services method.

But now in the new Project I don't see rest template.We just have @GetMapping/@PostMapping where we use response entity.

So is it not mandatory to use rest template for restful web services?


Solution

  • RTFM, Buddy ;)

    NOTE: As of 5.0, the non-blocking, reactive org.springframework.web.reactive.client.WebClient offers a modern alternative to the RestTemplate with efficient support for both sync and async, as well as streaming scenarios. The RestTemplate will be deprecated in a future version and will not have major new features added going forward.

    https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html