【发布时间】:2017-04-09 14:41:43
【问题描述】:
我有一个基于 spring.io 指南的简单 RepositoryRestResource
@RepositoryRestResource(collectionResourceRel = "people", path = "people")
public interface PersonRepository extends PagingAndSortingRepository<Person, Long>{
List<Person> findByLastName(@Param("name") String lastName);
}
这确实有效,因为我的 REST 客户端返回
{
"_links" : {
"people" : {
"href" : "http://127.0.0.1:8080/people{?page,size,sort}",
"templated" : true
},
"profile" : {
"href" : "http://127.0.0.1:8080/profile"
}
}
}
但我的问题是,_links 的 http://127.0.0.1:8080 部分来自哪里,我该如何更改它?当我的应用程序投入生产(或我的任何环境,如本地或开发)时,我宁愿能够看到类似 http://api.mydomain.com 的内容。
如果这很重要,我将使用mvn package 编译我的程序并将其作为独立的 jar 在服务器上运行。
【问题讨论】:
标签: java spring spring-boot spring-rest