我想公開我的倉庫的新端點,它也擴展了RevisionRepository。Spring Data Rest:公開擴展Repository的Repository的新端點
@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);
}
我的問題,現在,是這些新方法不公開爲URL(findLastChangeRevision
,findRevisions
),只有findByName
是搜索URL下。我目前並不特別關注實際的網址格式,只要它可以工作即可。
我現在所知道的唯一的選擇是
- 獨立的修訂庫
- 創建一個新的控制器,它映射到「/」,以取代由Spring數據休息創造了一個,並添加所有存儲庫手動鏈接。我的問題之一是我的鏈接將被硬編碼(與連接到控制器不同),路徑將是相對的 - 不一定是壞的,但會使所有內容不一致。
- 鏈接添加到「/」映射到修訂庫
我有很多與我上面的選項保留意見。我不知道如何繼續。
我也對這個問題的答案感興趣。我碰到類似的問題,我想擴展CrudRepository的API – 2014-12-28 19:11:52