1

I have a spring-data-rest repository that exposes rest endpoints for /students and /schools (the /schools repo is read only, but the /students is read/write).

I created my own custom controller with only a save method with @RequestMapping(value = "/schools/{id}/students", method = RequestMethod.POST). The save method basically allows me to add a student to a school without having to add a save() to the school repository.

But now when I run my application, I've lost the GET endpoint for /schools/{id}/students (method not allowed).

Does this mean I'm going to have to re-implement that GET method in my controller? What a pain that'd be. Is there any way to work around this?

Using spring boot 1.1.8.RELEASE

The repos

@RepositoryRestResource(path = StudentLinks.STUDENT, collectionResourceRel = StudentLinks.STUDENT, exported = true)
public interface StudentRestRepository extends ReadOnlyRepository<Student, Long> {

    Student save(Student entity);

}


@RepositoryRestResource(path = SchoolLinks.SCHOOL, collectionResourceRel = SchoolLinks.SCHOOL, exported = true)
public interface SchoolRestRepository extends ReadOnlyRepository<School, Long> {

}
gyoder
  • 4,530
  • 5
  • 29
  • 37

0 Answers0