小编syl*_*yum的帖子

Spring中有没有简单的HATEOAS + Pagination实现,无需数据休息?

我已经搜索了几天关于如何实现包含 HATEOAS 链接 + 使用 Spring boot 和 JPA 分页(无 spring 数据休息)的 Spring REST API,如下随机示例:

\n
{\n    "_links": {\n        "first": {\n            "href": "http://localhost:8080/api/albums-list?page=0&size=2&sort=title,desc"\n        },\n        "prev": {\n            "href": "http://localhost:8080/api/albums-list?page=0&size=2&sort=title,desc"\n        },\n        "self": {\n            "href": "http://localhost:8080/api/albums-list?page=1&size=2&sort=title,desc"\n        },\n        "next": {\n            "href": "http://localhost:8080/api/albums-list?page=2&size=2&sort=title,desc"\n        },\n        "last": {\n            "href": "http://localhost:8080/api/albums-list?page=4&size=2&sort=title,desc"\n        }\n    },\n    "page": {\n        "size": 2,\n        "totalElements": 10,\n        "totalPages": 5,\n        "number": 1\n    },\n    "_embedded": {\n        "albums": [\n            {\n                "id": 7,\n                "title": "Top Hits Vol 7",\n                "description": "Top hits vol 7. description",\n                "releaseDate": "10-03-1987",\n                "actors": [\n                    {\n                        "id": …
Run Code Online (Sandbox Code Playgroud)

java rest spring hateoas spring-hateoas

7
推荐指数
1
解决办法
6863
查看次数

标签 统计

hateoas ×1

java ×1

rest ×1

spring ×1

spring-hateoas ×1