spring-cloud / spring-cloud/spring-cloud-openfeign

@SpringQueryMap not working with Java Record

Open
#1,266 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.3k
Forks
838
Avg merge
2d 11h
Merged PRs (30d)
13

Description

Describe the bug
The problem is with @SpringQueryMap because it uses PageableSpringQueryMapEncoder which extends BeanQueryMapEncoder, limiting it to just these two encoders.

In feign.QueryMap, you can define mapEncoder as either BEAN or FIELD.

Image

Solution: Defines the Bean:

   @Bean
    public QueryMapEncoder feignQueryMapEncoderPageable() {
        return new FieldQueryMapEncoder();
    }

However, it is incompatible with Pageable throwing exception:

Request processing failed: java.lang.IllegalStateException: Duplicate key serialVersionUID (attempted merging values -4541509938956089562 and 1232825578694716871)] with root cause

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with PageableSpringQueryMapEncoder and its BeanQueryMapEncoder relationship, then compare the feign.QueryMap BEAN and FIELD options with FieldQueryMapEncoder. Reproduce the Java Record and Pageable cases described in the issue; done means record query parameters work without breaking Pageable or causing the duplicate serialVersionUID exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.