How do I apply a projection to a Spring Data REST query method resource?

夙愿已清 提交于 2019-11-30 13:27:54
Oliver Drotbohm

I verfied this working with Spring Data REST 2.2.1, so please update it. Make sure your client actually sends the the requested parameters as you intend. While debugging, I found out that e.g. cURL drops query parameters if you do not explicitly quote the URI. So this:

curl http://localhost:8080/orders/search/findByApplicant?applicant=5&projection=details

will not send any of the query parameters. Once you quote the URI, it will.

curl 'http://localhost:8080/orders/search/findByApplicant?applicant=5&projection=details'

Sort of the same is in place for the increasingly popular HTTPie. With it the required syntax is:

http :8080/orders/search/findByApplicant applicant==5 projection==details

In case you can't get it to work that way, it would be cool to get a running example project to look at.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!