Does Spring Version 4.3.20 work with Java 11?

Does Spring Version 4.3.20 work with Java 11?

Spring 5.1 supports Java 11, earlier versions do not. See Spring Framework Versions:

JDK Version Range

  • Spring Framework 5.1.x: JDK 8-12
  • Spring Framework 5.0.x: JDK 8-10
  • Spring Framework 4.3.x: JDK 6-8

and Whats New in Spring Framework 5.x:

Whats New in Version 5.1

General Core Revision

  • Infrastructure:
    • Warning-free support for JDK 11 on the classpath and the module path.

That 4.3.x works on Java 11 might just mean that you have been lucky up to now (not using things that are not compatible with Java 11). Also, Java is pretty good in backwards compatibility, even with the things removed or intentional backwards incompatible changes since Java 9, it is entirely possible that the real broken things in Spring are very small and obscure.

That said, I would not use a set of libraries as vast as Spring with Java 11 if the authors say that Java compatibility is only guaranteed in a later version than you use. If you want to use Spring with Java 11, upgrade to Spring 5.1.

Remember: tests can only prove the presence of bugs, not their absence.

According to some comments on their release blog, 4.3.20 is in deed not compatible with Java 11.

On the other hand: spring is a huge framework. So the simple answer might be: it works for, as long as you dont run into areas that will not work.

And keep in mind: any JDK of version N can run bytecode for bytecode that has older versions N-x.

Does Spring Version 4.3.20 work with Java 11?

Seems the compatibility is a common question in the community, so there is an answer (kinda) in Spring documentation: https://spring.io/blog/2015/04/03/how-spring-achieves-compatibility-with-java-6-7-and-8

Basically, Spring codebase itself does not use even the features of Java 7, therefore it is compatible with 6.

As to the bytecode transformation, I believe JVM keeps some level of compatibility due to its specs allowing some of the frameworks features to work.

However, if the official docs say it is not compatible, then you should rely on this accident, since other features may not work or get broken with patches and minor releases.

P.S. You also mentioned cglib which can be used to manipulate bytecode, but its not actually required. It does generate Java code or even bytecode that is always backward-compatible in new JVM releases.

Leave a Reply

Your email address will not be published. Required fields are marked *