Posts

Showing posts with the label @PutMapping

Spring @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, and @PatchMapping Annotations Example

Image
In this section we will learn about  @GetMapping , @PostMapping , @PutMapping , @DeleteMapping , and @PatchMapping  Annotations.   @GetMapping @GetMapping  annotation for mapping HTTP GET requests onto specific handler methods. Specifically,  @GetMapping  is a composed annotation that acts as a shortcut for  @RequestMapping(method = RequestMethod.GET) . Example: @GetMapping ( " /users " ) public List< User > getAllusers() { return userRepository . findAll(); } @PostMapping @PostMapping a nnotation for mapping HTTP POST requests onto specific handler methods. Specifically,  @PostMapping  is a composed annotation that acts as a shortcut for  @RequestMapping(method = RequestMethod.POST) . Example: @PostMapping ( " /users " ) public User createUser( @RequestBody User user) { return userRepository . save(user); } @PutMapping @PutMapping  annotation for mapping HTTP PUT requests onto specific handler methods. Specifically,  @PutMapping  is a composed annotat