Confusing behaviour: empty URL not allowed with default Client, but possible with ApacheHttpClient
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
FeignClientFactoryBean.loadBalance から開始し、デフォルトの Client パスと FeignAutoConfiguration.HttpClientFeignConfiguration によって登録された ApacheHttpClient Bean を比較します。空の @FeignClient URL に対する想定される動作を確認し、その結果を文書化またはテストして、両方の構成で明示的かつ一貫した結果になるようにします。
索引モデルが issue の本文から書いたものです。
説明
My issue is related to https://github.com/spring-cloud/spring-cloud-openfeign/issues/517.
I found after some debugging that contrary to the situation described in that ticket, if ApacheHttpClient is on the classpath (in my case through a dependency on io.github.openfeign:feign-httpclient), it is very well possible to specify an empty String for the url in a @FeignClient (in my case, I did it like this: @FeignClient(name = "myfeignclient", url = "${my.url:}"), i.e. with an empty String as default value and the property being absent).
This allows the context to come up at least and will only result in an UnknownHostException when a request is actually attempted to be sent through that FeignClient.
For us, this is quite convenient though in a development environment where the destination is not known or when working on someone else's project so not all the required configuration needs to be known.
The crucial difference seems to be in the method loadBalance in FeignClientFactoryBean. Without the ApacheHttpClient being available as a bean, getOptional returns null, leading to the IllegalStateException.
A bean of type ApacheHttpClient seemingly becomes registered through FeignAutoConfiguration.HttpClientFeignConfiguration.
I'm thinking that if the Client.Default implementation was exposed as a bean, both situations would behave the same.
Would this be a reasonable change? I read @OlgaMaciaszek's point on the other ticket that it is intended to fail(?) by design, but why should it work then with ApacheHttpClient? (please don't take away that possibility though, like I said above, we like it 😉)
- 主要言語
- Java
- スター
- 1.3k
- フォーク
- 834
- 平均マージ
- 3日 6時間
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
spring-cloud/spring-cloud-openfeign のほかの issue
-
@RequestHeader overrides @PathVariable with the same name再び着手できるかも @rajeshvasa が 11 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンwaiting-for-triage
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
spring-cloud/spring-cloud-openfeign#1465 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
question
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
spring-cloud/spring-cloud-openfeign#1392 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
FeignClientsConfiguration$MicrometerConfiguration.class cannot be opened because it does not existオープンfeedback-provided
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
spring-cloud/spring-cloud-openfeign#1379 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
waiting-for-triage
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
spring-cloud/spring-cloud-openfeign#1340 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
dependencies
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
spring-cloud/spring-cloud-openfeign#1334 · コメント 11 件 · リアクション 4 件 ·
メンテナーはふだん 1 日以内に返信
spring-cloud/spring-cloud-openfeign の issue をすべて見る
似ている issue
-
Add contributing guide対応中かも @WadekarPrashant が今日担当しました。 オープンgood first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
jenkinsci/gitea-checks-plugin#382 · コメント 1 件 ·
-
enhancement infra
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
5.0.x backport bug
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
spring-cloud/spring-cloud-function#1569 ·
メンテナーはふだん 1 日以内に返信
-
Move the spring-cloud-commons version and BOM import from the bus parent to the stream parent対応中かも @olegz が今日担当しました。 オープンtask
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
spring-cloud/spring-cloud-stream#3355 ·
メンテナーはふだん 1 日以内に返信
-
bug untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
opensearch-project/opensearch-java#2342 ·
メンテナーはふだん 1 日以内に返信