Implementing DELETE Method to Delete a User Resource
In this section, we will implement a delete method to delete a user resource.
Step 1: Open the UserDaoService.java file.
Step 2: Create a method to delete a user resource.UserDaoService.java
Step 3: Open the UserResource.java file and create a delete mapping to delete a user resource.
Step 4: Open Postman, select DELETE request, and specify the user id which you want to delete. Now click on the Send button.
It deletes user id: 3 and returns the Status: 200 Ok. Again send the Get request. It shows all users except user 3.
In the following image, we are trying to delete user id: 9, which does not exist. Hence it returns the Status: 404 Not Found.