Search code examples
springspring-bootspring-hateoas

Where is Spring ResourceSupport


I'm reading Spring in Action 5th. and to add hateoas hyperlink. this class is extending org.springframework.hateoas.ResourceSupport however I cannot find it. i'm using Spring Boot version 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;

So what's the name of this class in this version since the source code was using an older versio I think 2.0.2 M1


Solution

  • Below is from the Spring HATEOAS documentation

    The ResourceSupport/Resource/Resources/PagedResources group of classes never really felt appropriately named. After all, these types do not actually manifest resources but rather representation models that can be enriched with hypermedia information and affordances. Here’s how new names map to the old ones:

    ResourceSupport is now RepresentationModel

    Resource is now EntityModel

    Resources is now CollectionModel

    PagedResources is now PagedModel

    So since Spring HATEOAS 1.0, ResourceSupport is RepresentationModel

    Spring also has provided a migration script which can help in replacing the legacy Spring HATEOAS type references with the new ones.