Spring 数据 REST - collectionResourceRel 与路径

Spring Data REST - collectionResourceRel vs path

我正在使用 Spring 数据 REST。 RepositoryRestResource 注释有两个不同的字段:pathcollectionResourceRel。这两者有什么区别?我无法通过阅读文档来解决这个问题。

path说明:

The path segment under which this resource is to be exported.

collectionResourceRel说明:

The rel value to use when generating links to the collection resource.

在所有代码示例中,我都看到这两个属性相同。他们有什么不同吗?它们之间的实际区别是什么?

例如,对于实体 User,默认值将是:

路径 = users

itemResourceRel = user

collectionResourceRel = users

示例:

GET /users(路径:users

"_links": { 
        "self": {
            "href": "http://localhost:8080/api/users"
        },
        "users": {  <-- collectionResourceRel
            "href": "http://localhost:8080/api/users"
        }
    }

GET /users/1(路径:users

"_links": {
        "self": {
            "href": "http://localhost:8080/api/users/1"
        },
        "user": { <-- itemResourceRel
            "href": "http://localhost:8080/api/users/1"
        }
    }