【问题标题】:Path based on a non-PK unique field in spring-data-rest基于 spring-data-rest 中非 PK 唯一字段的路径
【发布时间】:2016-06-22 05:40:11
【问题描述】:

给定一个使用以下字段声明的@Entity:

@Id  
private String idgeo;  
private String isoCtryCd;  
private String randomField;  

使用默认的 spring 配置,我得到以 .../{idgeo} 结尾的资源路径。
spring 配置中是否有使用其他(唯一)字段作为资源路径结尾的选项?在我的例子中是 .../{isoCtryCd}

谢谢!

【问题讨论】:

    标签: java hibernate spring-data-rest


    【解决方案1】:

    其实这个特性会在 Spring Data Rest 2.5 中引入。目前有一个包含此功能的 2.5.0.M1 里程碑版本。

    这部分文档展示了如何为项目资源 uris 使用不同的实体属性。

    http://docs.spring.io/spring-data/rest/docs/2.5.0.M1/reference/html/#_customizing_item_resource_uris

    【讨论】:

    • 谢谢你,Mathias,这将是一个很棒的功能 :)
    猜你喜欢
    • 2014-03-28
    • 2016-04-18
    • 2018-10-28
    • 2012-12-24
    • 2019-09-13
    • 1970-01-01
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多