use*_*est 5 spring spring-hateoas spring-boot
我正在读《春天在行动》第五期。并添加 hatoas 超链接。这个类正在扩展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;
Run Code Online (Sandbox Code Playgroud)
那么这个版本中这个类的名称是什么,因为源代码使用的是较旧的版本,我认为是 2.0.2 M1
Mad*_*hat 14
以下来自Spring HATEOAS 文档
\n\n\n这
\nResourceSupport/Resource/Resources/PagedResources命名合适。毕竟,这些类型实际上并不体现资源,而是可以通过超媒体信息和可供性来丰富的表示模型。这里\xe2\x80\x99是新名称如何映射到旧名称的:\n
ResourceSupport就是现在RepresentationModel\n
Resource就是现在EntityModel\n
Resources就是现在CollectionModel\n
PagedResources就是现在PagedModel
所以从Spring HATEOAS 1.0开始,ResourceSupport是RepresentationModel
\nSpring也提供了迁移脚本,可以帮助用新的引用替换旧的 Spring HATEOAS 类型引用。
\n| 归档时间: |
|
| 查看次数: |
4164 次 |
| 最近记录: |