The boilerplate of not having sane defaults. .NET is much simpler:
using HttpClient client = new();
HttpResponseMessage response = await client.GetAsync("https://...");
if (response.StatusCode is HttpStatusCode.OK)
{
string s = await response.Content.ReadAsStringAsync();
// ...
}That's just an example. It does have defaults: https://docs.oracle.com/en/java/javase/11/docs/api/java.net.... (search for "If this method is not invoked")
Yeah, so much simpler,
"Common IHttpClientFactory usage issues"
https://learn.microsoft.com/en-us/dotnet/core/extensions/htt...
"Guidelines for using HttpClient"
https://learn.microsoft.com/en-us/dotnet/fundamentals/networ...
And this doesn't account for all gotchas as per .NET version, than only us old timers remember to cross check.