1.

What are the important annotation for Spring rest? What is the use case of this annotation?

Answer»
  • @RestController: Define at class level, so that spring CONTAINER will consider as RestENd point
  • @RequestMapping(value = "/PRODUCTS"): Define the REST URL for method level.
  • @PathVariable: Define as a method argument
  • @RequestBody: Define as a method argument
  • @ResponseEntity: To convert the domain object into the response format
  • @hasAuthority: To grant the access of corresponding endpoints 
  • @GetMapping: To make endpoint compatible for get request.
  • @PostMapping: To make endpoint compatible for POST request.
  • @PutMapping: To make endpoint compatible for put request.
  • @DeleteMapping: To make endpoint compatible for delete request.
  • @ResponseStatus: To generate the HTTP status.
  • @ResponseBody: To Generate the response message.


Discussion

No Comment Found