如何禁用或编辑spring数据rest HATEOAS默认配置文件链接
我目前在我的项目中有一个名为“profile”的实体(使用JPA);不过,api/profile会将您引向应用程序级别的详细信息。目前我没有使用@RepositoryRestResource重命名对象存储库的选项。配置中是否有方法禁用或重命名SpringDataREST中的应用程序级deatils端点如何禁用或编辑spring数据rest HATEOAS默认配置文件链接,spring,spring-data,spring-data-rest,spring-hateoas,Spring,Spring Data,Spring Data Rest,Spring Hateoas,我目前在我的项目中有一个名为“profile”的实体(使用JPA);不过,api/profile会将您引向应用程序级别的详细信息。目前我没有使用@RepositoryRestResource重命名对象存储库的选项。配置中是否有方法禁用或重命名SpringDataREST中的应用程序级deatils端点 "profile" : [ { "href" : "http://localhost:8080/api/profile{?page,size,sort}", "templated" : t
"profile" : [ {
"href" : "http://localhost:8080/api/profile{?page,size,sort}",
"templated" : true
}, {
"href" : "http://localhost:8080/api/profile"
} ],
选择“配置文件”链接可将我导向
}, {
"rel" : "profile",
"href" : "http://localhost:8080/api/profile/profile"
},
使用spring 4.2.1版本、spring data jpa 1.9和spring-data-rest-core-2.4.0版本您可以使用
资源处理器编辑根资源链接
像这样:
@Component
public class RootResourceProcessor implements ResourceProcessor<RepositoryLinksResource> {
@Autowired
private final EntityLinks entityLinks;
@Override
public RepositoryLinksResource process(final RepositoryLinksResource resource) {
final Link link = entityLinks.linkToCollectionResource(YourResource.class);
resource.getLinks(); //the root links
return resource;
}
}
@组件
公共类RootResourceProcessor实现ResourceProcessor{
@自动连线
私有最终实体链接实体链接;
@凌驾
公共RepositoryLinksResource流程(最终RepositoryLinksResource资源){
final Link=entityLinks.linkToCollectionResource(yoursource.class);
resource.getLinks();//根链接
返回资源;
}
}