EntityModel is Deprecated
firewater opened this issue · comments
Nicholas Kline commented
Closed by author and moved to issue #88 instead. Thanks.
The Spring HATEOAS section of the tutorial contains deprecated code, according to IntelliJ. Specifically, EntityModel:
@GetMapping("/employees/{id}")
EntityModel<Employee> one(@PathVariable Long id) {
Employee employee = repository.findById(id)
.orElseThrow(() -> new EmployeeNotFoundException(id));
return new EntityModel<>(employee,
linkTo(methodOn(EmployeeController.class).one(id)).withSelfRel(),
linkTo(methodOn(EmployeeController.class).all()).withRel("employees"));
}
This page recommends using of(object, iterable)
instead.
This is my first exposure to Spring so I have no idea what I am doing. Can we please have the tutorial updated? Thanks.