I'm trying to understand reactive part of spring 5. I have created simple rest endpoint for finding all entities using spring web-flux and spring data reactive (mongo) but don't see any way how to implement pagination.

Here is my simple example in Kotlin:

@GetMapping("/posts/")
fun getAllPosts() = postRepository.findAll()

Does it mean that reactive endpoint does not require pagination?是使用这个堆栈从服务器端实现分页的某种方式吗?

推荐答案

The reactive support in Spring Data does not provide means of a Page return type. Still, the Pageable parameter is supported in method signatures passing on limit and offset to the drivers and therefore the store itself, returning a Flux<T> that emits the range requested.

Flux<Person> findByFirstname(String firstname, Pageable pageable);

更多信息请看一下目前的Reference Documentation for 2.0.RC2Spring Data Examples.

Kotlin相关问答推荐

Kotlin -通过反射获得KProperty 1和CallableReference的实例

用普通Kotlin理解Gradle的Kotlin DSL'""

Android Jetpack编写androidx.compose.oundation.lazy.grid.Items

Scala性状线性化等价于Kotlin

有没有办法在 jetpack compose 中将 TextField 密码点图标增加得更大?

generic 类实例列表 - 调用采用 T 的函数

如何使用 Android CameraX 自动对焦

从 Java 调用 Kotlin 高阶函数

@InlineOnly 注释是什么意思?

Kotlin 枚举中的循环引用

在kotlin中,如何模拟封装回调函数?

main函数和常规函数有什么区别?

将ExpectedException与Kotlin一起使用

Kotlin val difference getter override vs assignment

如何解决:将Java类转换为Kotlin后出现error: cannot find symbol class ...?

如何在Kotlin中使方法param可变?

Dagger +Kotlin 不注入

Kotlin中的属性(properties)和参数(parameters)有什么区别?

Android Kotlin .visibility

在多平台子元素中使用kapt