【发布时间】:2014-06-16 02:54:51
【问题描述】:
按照此处的 spring.io 示例:http://spring.io/guides/gs/accessing-data-rest/ 将存储库公开为 REST Web 服务工作得很好,但我看不到如何更改公开服务的 URL。 API 文档对于注解参数的含义有些模糊,可能是假设了一些先验知识。
我想要什么 - 在 http://localhost:8080/api/people 访问的 HATEOAS 服务,用于 People 存储库。我想只使用注释来实现这个 URL,而不是弄乱上下文根或类似的东西。我尝试了以下存储库注释:
@RepositoryRestResource(collectionResourceRel = "api/people", path = "people")@RepositoryRestResource(collectionResourceRel = "people", path = "api/people")@RepositoryRestResource(collectionResourceRel = "api/people", path = "api/people")
这些都不起作用。
我知道我可能错过了明显的,非常感谢任何能指出它的人。
【问题讨论】:
-
在你的 application.properties: spring.data.rest.base-path=/api source: docs.spring.io/spring-data/rest/docs/current/reference/html/…
标签: rest spring-boot