-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
java.lang.NoSuchMethodError: ResponseEntity.getStatusCode() when running code built with Spring 5.x on Spring 6.x #29813
Comments
This change was done in a source compatible way, but not binary compatible way. |
@bclozel the issue is here that you cannot create a library that is Spring 5.x and 6.x compatible. Is this really intended? |
This incompatibility also exists in the other direction - code compile with 6.0.x is not running with 5.3.x
|
@derkoe we do our best to retain compatibility, but keeping binary compatibility between major versions is a huge ask. You cannot create a library that is Spring 5.x and 6.x compatible in the first place anyway: they have different Java baselines. If you're compiling your library with Java 17, it's not compatible with all Spring 5.x applications. |
Affects: 6.0.x - tested with 6.0.4
The signature of
ResponseEntity#getStatusCode
was changed in Spring Framework 6.x - it now returnsHttpStatusCode
(Spring 5.x returnedHttpStatus
) - see #28214. The idea was that the change is backward compatible.How to reproduce:
Create this simple test class in a file
Test.java
:Compile the application with Spring 5.3.x:
Run the application with Spring 6.0x:
With Spring 5.3.x it works as expected:
The text was updated successfully, but these errors were encountered: