[英]Spring Data Rest: Expose new endpoints for Repository that extends Revision Repository
I would like to expose new endpoints for my repository which also extends RevisionRepository. 我想为我的存储库公开新的端点,这也扩展了RevisionRepository。
@RepositoryRestResource(collectionResourceRel = "persons", itemResourceRel = "person", path = "persons")
public interface PersonRepository extends PagingAndSortingRepository<PersonEntity, Long>, RevisionRepository<PersonEntity, Long, Integer> {
Revision<Integer, PersonEntity> findLastChangeRevision(@Param("id") Long id);
Revisions<Integer, PersonEntity> findRevisions(@Param("id") Long id);
Page<Revision<Integer, PersonEntity>> findRevisions(@Param("id") Long id, Pageable pageable);
PersonEntity findByName(@Param("name") String name);
}
My issue right now, is that these new methods are not exposed as urls ( findLastChangeRevision
, findRevisions
) and only findByName
is under the search url. 我现在的问题是,这些新方法没有公开为url(
findLastChangeRevision
, findRevisions
),只有findByName
位于搜索网址下。 I am currently not very particular with regards to the actual url form, as long as it works. 我目前对于实际的网址形式并不是特别关注,只要它有效。
The only option I know right now is to 我现在知道的唯一选择是
I have a lot of reservations with my option above. 我对上面的选项有很多保留意见。 I am not sure how to proceed.
我不知道该怎么办。
You have made a mistake in your method names. 你在方法名称中犯了一个错误。 Find methods in the Repository class should be findByxxxxxx not findxxxxx
在Repository类中查找方法应该是findByxxxxxx而不是findxxxxx
That seems to be the problem with your code. 这似乎是您的代码的问题。
@RepositoryRestResource(collectionResourceRel = "persons", itemResourceRel = "person", path = "persons")
public interface PersonRepository extends PagingAndSortingRepository<PersonEntity, Long>, RevisionRepository<PersonEntity, Long, Integer> {
Revision<Integer, PersonEntity> findByLastChangeRevision(@Param("id") Long id);
Revisions<Integer, PersonEntity> findByRevisions(@Param("id") Long id);
Page<Revision<Integer, PersonEntity>> findByRevisions(@Param("id") Long id, Pageable pageable);
PersonEntity findByName(@Param("name") String name);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.