Spring ResourceSupport在哪里

问题描述 投票:1回答:1

我正在阅读Spring in Action 5th。并添加hateoas超链接。此类正在扩展org.springframework.hateoas.ResourceSupport,但是我找不到它。我正在使用Spring Boot版本2.2.5.RELEASE

import org.springframework.hateoas.ResourceSupport;
import tacos.Taco;

@Relation(value = "taco", collectionRelation = "tacos")
public class TacoResource extends ResourceSupport {

    private static final IngredientResourceAssembler ingredientAssembler = new IngredientResourceAssembler();

    @Getter
    private final String name;

所以,由于源代码使用的是较早的版本,所以我在这个版本中该类的名字是什么?我认为是2.0.2 M1

spring spring-boot spring-hateoas
1个回答
0
投票

下面来自Spring HATEOAS documentation

ResourceSupport /Resource/Resources/ PagedResources组类从来没有真正被恰当地命名过。毕竟,这些类型实际上并不表示资源,而是表示模型,可以通过超媒体信息和提供的内容来丰富它们。这是新名称映射到旧名称的方式:

[ResourceSupport现在是RepresentationModel

[Resource现在是EntityModel

[Resources现在是CollectionModel

[PagedResources现在是PagedModel

因此,由于Spring HATEOAS 1.0],ResourceSupportRepresentationModel

Spring还提供了migration script,可以帮助用新的替换旧的Spring HATEOAS类型引用。

© www.soinside.com 2019 - 2024. All rights reserved.