@SpringQueryMap does not work with records under certain conditions

オープン
#1,202 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java, mongodb, spring, spring-boot
領域
api, backend

調査の方向性

提供されたダミーアプリケーションから始め、spring-boot-starter-data-mongodb が存在する状態で record を使ったリクエストを再現し、その後、クラスベースの場合および依存関係なしの場合と比較します。Feign client が使用する @SpringQueryMap の処理を追跡し、欠落しているクエリ文字列の回帰テストを追加します。MongoDB starter が有効な状態で、record のリクエストが /test?foo=foo を送信すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

waiting-for-triage

We ran into an issue where @SpringQueryMap was not working in one of our apps. I created a dummy app to try and diagnose the issue, but it wasn't until I stumbled across this bug that I identified the problem. Unlike the other bug, it was spring-boot-starter-data-mongodb in our case. Below is some sample code. Without spring-boot-starter-data-mongodb, it works fine. Add spring-boot-starter-data-mongodb and the querystring no longer gets sent.

@FeignClient(name = "scratch-service", url = "http://localhost:8091")
public interface ScratchClient
{
    @Builder
    record Test(String foo)
    {
    }

    @GetMapping("/test")
    void test(@SpringQueryMap final Test test);
}
@RequiredArgsConstructor
@Slf4j
@RestController
public class ScratchController
{
    private final ScratchClient scratchClient;

    @GetMapping("/test")
    public void test(final ScratchClient.Test test)
    {
        log.info("test: {}", test);
    }

    @GetMapping("/feign")
    public void feign()
    {
        scratchClient.test(ScratchClient.Test.builder().foo("foo").build());
    }
}

with spring-starter-data-mongodb...

http-outgoing-0 >> GET /test HTTP/1.1

without...

http-outgoing-0 >> GET /test?foo=foo HTTP/1.1

This was tested with Spring Boot 3.4.5 and Spring Cloud 2024.0.1

Switching it from a record to a class does not have this compatibility issue.

主要言語
Java
スター
1.3k
フォーク
834
平均マージ
3日 6時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

spring-cloud/spring-cloud-openfeign のほかの issue

spring-cloud/spring-cloud-openfeign の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。