Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何禁用或编辑spring数据rest HATEOAS默认配置文件链接_Spring_Spring Data_Spring Data Rest_Spring Hateoas - Fatal编程技术网

如何禁用或编辑spring数据rest HATEOAS默认配置文件链接

如何禁用或编辑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”的实体(使用JPA);不过,api/profile会将您引向应用程序级别的详细信息。目前我没有使用@RepositoryRestResource重命名对象存储库的选项。配置中是否有方法禁用或重命名SpringDataREST中的应用程序级deatils端点

"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();//根链接
返回资源;
}
}