Spring 文档在这里告诉我:code 我应该使用 CollectionModel 而不是 Resources 类。但是当我这样做时,我的 IDE 告诉我 CollectionModel 已被弃用。喜欢这里:
https://docs.spring.io/spring-hateoas/docs/1.2.2/reference/html/#migrate-to-1.0.changes.representation-models
现在应该怎么做或者现在用什么来实现Spring boot中的HATEOAS?
仅弃用构造函数。 相反,您应该使用 CollectionModel public static <T> CollectionModel<T> of(Iterable<T> content,Iterable<Link> links)
public static <T> CollectionModel<T> of(Iterable<T> content,Iterable<Link> links)
更多信息在这里: https://docs.spring.io/spring-hateoas/docs/current/api/org/springframework/hateoas/CollectionModel.html#CollectionModel-java.lang.Iterable-org.springframework.hateoas.Link...-