Considering Custom implementations for Spring Data repositories I am using the @RepositoryRestResource
on repository to bring all the HATEOAS generated goodnes:
@RepositoryRestResource(collectionResourceRel = "people", path = "people")
public interface PersonRepository extends PagingAndSortingRepository<PersonNode,Long>,
PersonRepositoryCustom {
List<PersonNode> findBySurname(@Param("0") String name);
}
Now following the mentioned docs I have created the PersonRepositoryCustom
with additional, simple method for introductory purposes:
public interface PersonRepositoryCustom {
public String printPerson(PersonNode personNode);
}
The implementation is:
public class PersonRepositoryImpl implements PersonRepositoryCustom{
@Override
public String printPerson(PersonNode personNode) {
return "It Works!";
}
}
I want the default SDR autogenerated endpoints to remain and just add the new custom methods/new implementations.
How am I supposed to use this custom method with spring-data Rest/HATEOAS?
With simple @RepositoryRestResource
the controller endpoints are autogenerated. What if I want to provide some custom methods? I presume I would have to create controller manually but how should it look like in this exemplary case?