我通过创建一个扩展了RepositoryRestMvcConfiguration的Java配置类,并将@RestResource添加到仓库中,向现有的Spring MVC应用程序中添加了Spring Data Rest(2.0)。
是否可以更改Rest API的基本URL?例如:
http://localhost:8080/rest/customers
代替
http://localhost:8080/customers
我尝试使用setBaseURI来覆盖configureRepositoryRestConfiguration,但似乎并未应用于响应中的所有链接。
spring.data.rest.base-path
被忽略了。原来我在代码库中有一个RepositoryRestMvcConfiguration
类(在从 Spring 切换到 Spring Boot 之前就存在)。删除该类后,该属性按预期工作。 - murf