Brugte @Controller i stedet for @RepositoryRestController hvilket fik tingene til at virke.
Vi kan nu nemt tilsidesætte POST-metoden på denne ressource for at returnere, hvad vi vil, mens vi holder spring-data-rests implementering af EmployeeRepository intakt.
@RepositoryRestController
public class EmployeeController {
private final static String URI_EMPLOYEES = "/employees";
@Autowired private EmployeeRepository repo;
@RequestMapping(value=URI_EMPLOYEES, method=RequestMethod.POST)
public @ResponseBody HttpEntity<Employee> addVideo(@RequestBody Employee employee) {
return new ResponseEntity<Employee>(repo.save(employee), HttpStatus.OK);
}
}