amdg
amdg

Reputation: 2239

SpringData - CosmosDB - FluxUsingWhen cannot be cast to class Slice - Pagination

I am trying implement Pagination in cosmosdb as per the link here as follows.

@Repository
public interface UserRepository extends ReactiveCosmosRepository<User, String>{
    Slice<User> findByUserId(String userId, Pageable pageable);
}

POM.xml

...
<groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.13</version>
<dependency>
            <groupId>com.azure</groupId>
            <artifactId>azure-spring-data-cosmos</artifactId>
            <version>3.43.0</version>
        </dependency>
...

However, I'm getting the error on the method findByUserId as below.

Caused by: java.lang.ClassCastException: class reactor.core.publisher.FluxUsingWhen cannot be cast to class org.springframework.data.domain.Slice (reactor.core.publisher.FluxUsingWhen and org.springframework.data.domain.Slice are in unnamed module of loader java.net.URLClassLoader @37c9dbe)
[2024-03-06T15:45:45.536Z]  at com.sun.proxy.$Proxy90.findByUserId(Unknown Source)
[2024-03-06T15:45:45.536Z]  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Any help?

Upvotes: 0

Views: 59

Answers (0)

Related Questions