@GetMapping @PutMapping @PostMapping @DeleteMapping @PatchMapping Difference

--

There are several requests in spring
I will explain four typical requests

@GetMapping

The GetMapping contains information in the header, so there is a limit to the capacity, so it is mainly used to recall information

@GetMapping("/getUserInfo")

@PostMapping

The PostMapping is safer than the GetMapping because it contains information in HttpBody and sends it, so
it is mainly used when registering new information.

@PostMapping("/addUserInfo")

@DeleteMapping

DeleteMapping is mainly used to delete existing information.

@DeleteMapping("/deleteUserInfo")

@PutMapping

PutMapping is mainly used to modify existing information

@PutMapping("/updateUserInfo")

@PatchMapping

Use PatchMapping to modify some information

@PatchMapping("/modifyUserInfo")

PutMapping vs PatchMapping

When needs to replace an existing Resource entirely,
can use PutMapping
When doing a partial update, they can use PatchMapping

in conclusion..
Select
: GetMapping
Insert : PostMapping
update : PatchMapping, PutMapping
delete : DeleteMapping

--

--