Spring Rest资源更改路径 [英] Spring rest resource change path

查看:76
本文介绍了Spring Rest资源更改路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个以 @RepositoryRestResource 注释的存储库.我要添加以下内容:

I currently have a repository annotated with @RepositoryRestResource. I'm adding the following:

@RestResource(path="make", rel = "make", description = @Description("Get vehicles by make"))
List<Vehicle> findByMake(@Param("make") String make);

这正常工作,但默认路径为 api/vehicles/search/make .

This works fine but the path by default is api/vehicles/search/make.

如何删除/search 部分,仅将路径设为 api/vehicles/make ?

How can I remove the /search part and just have the path be api/vehicles/make?

推荐答案

很遗憾,这是不可能的.我对Spring Data Rest源代码进行了一些研究.

Unfortunately it's not possible. I make some research in Spring Data Rest source code.

And here is the action method that handle requests by services with @RepositoryRestResource annotation. So as you can see the search part is hardcoded and couldn't be changed.

这篇关于Spring Rest资源更改路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆