USER.GET() gives error and idk both why happens and how to google. Is there anyone who knows how to solve this error ?
thanks for your concern!!
@GetMapping("/users/{id}")
public EntityModel<User> retrieveUser(@PathVariable int id) {
User user = service.findOne(id);
if(user == null) {
throw new UserNotFoundException("id-" + id);
}
//FOLLOWING LINE GIVES ERROR
EntityModel<User> model = new EntityModel<>(user.get());
WebMvcLinkBuilder linkTo = linkTo(methodOn(this.getClass()).retrieveAllUsers());
model.add(linkTo.withRel("all-users"));
}