Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to OkHttp 4.9.3 #18506

Closed
larsgrefer opened this issue Oct 3, 2019 · 14 comments
Closed

Upgrade to OkHttp 4.9.3 #18506

larsgrefer opened this issue Oct 3, 2019 · 14 comments
Assignees
Labels
type: dependency-upgrade A dependency upgrade
Milestone

Comments

@larsgrefer
Copy link
Contributor

I propose to update to OkHttp 4 for Spring Boot 2.2.x.

Despite being a new major version, it's binary and java-source compatible with OkHttp 3.
It even uses the Maven-Coordinates and the package name of OkHttp 3.

More information about this can be found here: https://square.github.io/okhttp/upgrading_to_okhttp_4/

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 3, 2019
@wilkinsona
Copy link
Member

Thanks for the suggestion. I think the switch to OkHttp4 and the introduction of a dependency on Kotlin is too big a change to make in 2.2, particularly after RC. Furthermore, Spring Framework 5.2 compiles and tests against 3.x. Thanks anyway.

@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 4, 2019
@membersound
Copy link

membersound commented Jan 23, 2020

I cannot see the point here. I mean, the kotlin dependency is just pulled into the test scope then, not adding into the packaged project. So why not upgrading the library to 4.x?

@wilkinsona
Copy link
Member

OkHttp is more than just the mock web server. It is also primarily used as an HTTP client in main application code. This means that moving to 4.x would result in Kotlin being pulled into the packaged project.

@membersound
Copy link

Oh ok, that's not what I expected, because as Spring is having RestTemplate and WebClient already, I thought okhttp is used for testing purpose only...

@scottfrederick
Copy link
Contributor

scottfrederick commented Jan 24, 2020

RestTemplate and WebClient don't implement the HTTP transport layer directly, but delegate to external libraries like Apache HttpComponents, OkHttp, Netty, or simply java.net.HttpURLConnection to handle the transport layer.

See ClientHttpRequestFactory in Spring Framework and it's usages in RestTemplateBuilder in Spring Boot for more details.

@odin568
Copy link

odin568 commented Dec 10, 2021

@wilkinsona The issue is quite old and it was clear to have that rejected to that time.
Are there any plans in the meantime as quite some time passed?

@wilkinsona
Copy link
Member

We don't have any plans to upgrade at this time. Spring Framework 5.3 continues to compile against 3.x and we continue to feel that version 4's Kotlin dependency is too large for Spring Boot to use that version by default.

@larsgrefer
Copy link
Contributor Author

What are the Plans for Framework 6.x and Boot 3.x? Will they update to OkHttp 4.x?

@snicoll
Copy link
Member

snicoll commented Dec 16, 2021

@larsgrefer there's no plan to upgrade to OkHttp 4.x at all at this time for the reason described above.

@k163377
Copy link
Contributor

k163377 commented Jan 19, 2022

Is there any update on this issue?
As mentioned in the README, OkHttp 3 will not be updated any more, so I think some action is needed.
https://github.com/square/okhttp#requirements

@wilkinsona
Copy link
Member

wilkinsona commented Jan 19, 2022

@k163377 Any updates will be added to this issue when we have them. Nothing's really changed from our perspective, particularly as Spring Framework continues to depend on 3.x. If you are interested in seeing if the Spring ecosystem can move to OkHttp 4.x, Framework is the place to start.

@bclozel bclozel added the for: team-meeting An issue we'd like to discuss as a team to make progress label Feb 10, 2022
@philwebb philwebb changed the title Update to OkHttp 4 for Boot 2.2.x Upgrade to OkHttp 4 Feb 16, 2022
@philwebb philwebb added type: dependency-upgrade A dependency upgrade and removed status: declined A suggestion or change that we don't feel we should currently apply for: team-meeting An issue we'd like to discuss as a team to make progress labels Feb 16, 2022
@philwebb philwebb added this to the 2.x milestone Feb 16, 2022
@philwebb philwebb reopened this Feb 16, 2022
@philwebb
Copy link
Member

philwebb commented Feb 16, 2022

We're going to revisit things in 2.x In light of the fact that OkHttp 3 is no longer being supported. Our initial thoughts are that we should upgrade to OkHttp 4 and users that don't like the additional Kotlin stdlib dependency can either downgrade or migrate to something else.

@wilkinsona
Copy link
Member

wilkinsona commented Feb 18, 2022

This change is not backwards compatible from Boot's perspective. Tests for RestTemplateBuilder are unable to get the connect and read timeout when using OkHTTP 4.9.3.

@wilkinsona
Copy link
Member

Scratch that. It turns out we can improve the tests for 3.14 to use an API that's also available in 4.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: dependency-upgrade A dependency upgrade
Projects
None yet
Development

No branches or pull requests

10 participants