Spring boot Rest 模板偏移和限制
我正在开发 Spring boot 应用程序,必须调用客户端休息服务,那里可以看到 10000 条记录。但是我需要使用休息来调用他们的服务,一次限制为 50 条记录,接下来的 50 条记录,依此类推,最多 10000 条记录。请分享您对此的意见。
I am Working on Spring boot application and have to call client rest service there could see 10000 records.But i need to call their service using rest with limit of 50 records at time and next 50 records and so on up to 10000 records.Kindly please share your input on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您想要如何进行限制。如果您使用本机查询,则可以在查询中进行限制。然而,这种方法并不那么聪明,因为您稍后需要 pther 数据。聪明的想法是使用分页等方法来限制视图,这些方法几乎在所有前端或模板引擎中都可用。在 Spring thymeleaf 的情况下,结合引导程序支持分页等技术来限制结果和视图级别,而不是在 API 级别
It depends with how you want to do the limit. If you're using native Queries you can limit in the query. However this approach is not that smart because you'd need the pther data later. The smart idea is to limit in the view using approaches like pagination which are available in nearly all frontend or templating engines In case of spring thymeleaf together with technologies like bootstrap support pagination to limit results and view level rather than at api level