Find the code snippet getAllUserByID() operation as follows:
// to get one specific user details
@GetMapping("/user/{id}")
fun getUser(@PathVariable(name = "id") id: Long): UserModel {
return userRepository.findById(id).get()
}
The @GetMapping(path = ["/user/{id}"]) annotation is the URL path of "/user/{id}", and it is a GET request with a specific ID. Here, we return findById(id).get() to get the specific user details from the database.