All I have to do is wrap the entity in org.springframework.hateoas.EntityModel and the URI will be perfectly converted
@RequestMapping(method = { RequestMethod.PUT }, path = "/{pos}", consumes = {MediaType.APPLICATION_JSON_VALUE, "application/hal+json"})
public ResponseEntity<Activity> edit(@PathVariable("pos") long pos, @RequestBody EntityModel<Activity> activity) {
// custom logic...
Activity updated = repository.save(activity);
return ResponseEntity.ok(updated);
}