Skip to content

Is not record class supported when using @SpringQueryMap? #1927

Open
@DaehunGwak

Description

@DaehunGwak

Hello.
When the @SpringQueryMap parameter is apllied as record class, http query is not recognized.
Is there some plan or has it already been updated?

using feign version

  • feign-core: 11.10
  • feign-form-spring: 3.8.0

test result

summary

  • If there is no getter (field accessor starting with get) when defining the class used in '@SpringQueryMap', it will not be recognized by feign

test type

  • record class
  • record class + get acessor
  • normal + getter

test report

record class

record class

public record PostQueryRecord(Long postId) {
}

feign method

@GetMapping("/comments")
void getCommentsRecord(@SpringQueryMap PostQueryRecord query);

result: query parameter is not recognized

[TestFeingClient#getCommentsRecord] ---> GET https://jsonplaceholder.typicode.com/comments HTTP/1.1

record class + adding get accessor

record class + get accessor

public record PostQueryRecordGetter(Long postId) {
    public Long getPostId() {
        return postId;
    }
}

feign method

@GetMapping("/comments")
void getCommentsRecordGetter(@SpringQueryMap PostQueryRecordGetter query);

result: query parameter is recognized

[TestFeingClient#getCommentsRecordGetter] ---> GET https://jsonplaceholder.typicode.com/comments?postId=1 HTTP/1.1

normal class + getter accesor

normal class

@Getter
@RequiredArgsConstructor
public class PostQueryClass {
    private final Long postId;
}

feign method

@GetMapping("/comments")
void getCommentsRecord(@SpringQueryMap PostQueryClass query);

result: query parameter is recognized

[TestFeingClient#getCommentsRecord] ---> GET https://jsonplaceholder.typicode.com/comments?postId=1 HTTP/1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    feedback providedFeedback has been provided to the authorspring-cloudIssues related to Spring Cloud OpenFeign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions