In a nutShell , when i try to use slice/page as method reuturn value in r2dbc , i encounter the error , below is two difference api reference and corrsponding error stack
Flux<Slice<Object>>
Flux<Slice<ChatMsg>> findBySessionId(Long sessionId , Pageable pageable);
Caused by: java.lang.ClassCastException: class com.ifx.account.entity.ChatMsg cannot be
cast to class org.springframework.data.domain.Slice (com.ifx.account.entity.ChatMsg and
org.springframework.data.domain.Slice are in unnamed module of loader 'app')
Slice<Object>
Slice<ChatMsg> findBySessionId(Long sessionId , Pageable pageable);
Caused by: java.lang.IllegalStateException: Method has to use a either multi-item reactive
wrapper return type or a wrapped Page/Slice type; Offending method: public abstract
org.springframework.data.domain.Slice
com.ifx.account.repository.ChatMsgRepository.findBySessionId(java.lang.Long,org.springfram-
ework.data.domain.Pageable)
Is previous example in a incorrect way? Alternatively , what should i do in order to troubleshoot?