Java Interview Series: Spring RESTful Web Services

Interview questions to prepare on Spring framework-based REST services

Midi
4 min readDec 7, 2021

1. What is the Spring RestTemplate?

It is the central class within the Spring framework for executing Spring-based RESTful services on the client-side. 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.

2. What are the direct annotations for specifying HTTP methods in Spring?

The annotations are:

@GetMapping

@PostMapping

@PutMapping

@DeleteMapping

@PatchMapping

3. What is the @RestController annotation do?

It is a combination of the @Controller and @ResponseBody annotations. It is used…

--

--