Spring 如何提供「;“等级制”;URI方案?

Spring 如何提供「;“等级制”;URI方案?,spring,rest,uri,Spring,Rest,Uri,对于我正在从事的一个项目,我正在寻找Spring注释和其他魔法来为我提供: 假设我有两个REST存储库: @RepositoryRestResource(path="/customers") public interface CustomerRepository implements PagingAndSortRepository { } @RepositoryRestResource(path="???") public interface OrderRepository implement

对于我正在从事的一个项目,我正在寻找Spring注释和其他魔法来为我提供:

假设我有两个REST存储库:

@RepositoryRestResource(path="/customers")
public interface CustomerRepository implements PagingAndSortRepository {
}

@RepositoryRestResource(path="???")
public interface OrderRepository implements PagingAndSortRepository {
}
假设
订单
客户
的子资源,这意味着
客户
可以有多个
订单
(1-N)

这里是我的问题:我希望
订单
在以结尾的URI下可用

...../customers/{customer_id}/orders/{order_id}
有没有办法告诉Spring一个是另一个的子资源,一个
订单
资源的路径应该相对于其所有者
客户
的路径


我一直在寻找子资源、相对路径、层次URI方案等,但什么都没有找到。我想我缺少正确的搜索键了?

为什么要使用相对路径?使用绝对路径

@RepositoryRestResource(path="/customers/{customer_id}/orders/{order_id}")

为什么要使用相对路径?使用绝对路径

@RepositoryRestResource(path="/customers/{customer_id}/orders/{order_id}")