1.

Define RestTemplate in Spring.

Answer»

The RestTemplate is the MAIN class meant for the client-side access for Spring-based RESTful services. The communication to the server is accomplished using the REST CONSTRAINTS. This is similar to other template classes such as JdbcTemplate, HibernateTemplate, etc provided by Spring. The RestTemplate provides high-level implementation details for the HTTP Methods like GET, POST, PUT, etc, and gives the methods to communicate using the URI template, URI path params, request/response types, request object, etc as PART of arguments.

  • Commonly used annotations like @GetMapping, @PostMapping, @PutMapping, etc are provided by this class from Spring 4.3. Prior to that, Spring provided (and still provides) @RequestMapping ANNOTATION to indicate what methods were being used.


Discussion

No Comment Found