When I define a method in my feign client with only a Pageable argument, this is handled in the FieldQueryMapEncoder.

PagedModel<EntityModel<Foo>> getFooPaged(Pageable pageable).

This throws an IllegalStateException because in the method feign.querymap.FieldQueryMapEncoder#encode it tries to put 2 serialVersionUI keys in a map.

Spring Cloud Openfeign Pageable argument is handled in FieldQueryMapEncoder

This is broken when going from version 4.0.1 to 4.0.2.

Caused by: java.lang.IllegalStateException: Duplicate key serialVersionUID (attempted merging values -4541509938956089562 and 1232825578694716871)
    at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:135)
    at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:182)
    at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
    at feign.querymap.FieldQueryMapEncoder.encode(FieldQueryMapEncoder.java:49)
    at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.toQueryMap(ReflectiveFeign.java:267)
    at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.create(ReflectiveFeign.java:248)
    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:67)
    at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:98)
    at jdk.proxy2/jdk.proxy2.$Proxy262.getTmcLocationsPaged(Unknown Source)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:141)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:218)
    at jdk.proxy2/jdk.proxy2.$Proxy263.getFooPaged(Unknown Source)

Comment From: rubenqba

Same here, but it also happens with any combination of parameters. The problem is with the hierarchy of AbstractPageRequest as @steinmaerivoet indicated. As a workaround, in our project we added a reimplementation of PageRequest without a serialVersionUID and then used it as Pageable. I hope this issue will be solved soon.

Comment From: orange-guo

It appears that the Feign client is being created manually. In such cases, the default queryMapEncoder used by Feign.Builder is FieldQueryMapEncoder. To use PageableSpringQueryMapEncoder instead, you need to call the queryMapEncoder() method on the Feign.Builder instance and pass in an instance of PageableSpringQueryMapEncoder as an argument.

Comment From: OlgaMaciaszek

Hello @steinmaerivoet @rubenqba does the solution suggested by @orange-guo solve your issue? If not, please provide a minimal, complete, verifiable example that reproduces the issue.

Comment From: rubenqba

In my case it does. I use a client manually created, so @orange-guo solution is the correct one in my case.

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.