Closed mspiess closed 3 months ago
Nevermind, this is by design: https://docs.spring.io/spring-graphql/reference/data.html#data.pagination.scroll.keyset
The complete EncodingCursorStrategy
needs has to be provided in order to change this:
@Bean
fun cursorStrategy(): EncodingCursorStrategy<ScrollPosition> {
val validator: PolymorphicTypeValidator = BasicPolymorphicTypeValidator.builder()
.allowIfBaseType(Map::class.java)
.allowIfSubType(java.lang.Long::class.java)
.build()
val mapper = ObjectMapper()
mapper.activateDefaultTyping(validator, ObjectMapper.DefaultTyping.NON_FINAL)
val configurer: CodecConfigurer = ServerCodecConfigurer.create()
configurer.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(mapper));
configurer.defaultCodecs().jackson2JsonEncoder(Jackson2JsonEncoder(mapper));
val jsonKeysetCursorStrategy = JsonKeysetCursorStrategy(configurer)
return CursorStrategy.withEncoder(ScrollPositionCursorStrategy(jsonKeysetCursorStrategy), CursorEncoder.base64())
}
Minimum example:
Stacktrace:
Tested on versions 1.3.1 & 1.3.2.