Pregunta

Our team is planning on moving to Java 7 from Java 6 and to Spring 4.0 from Spring 3.x.

My question is how much is Spring 4.0 tuned for Java 7. I have found online that Spring 4.0 is Java 8 ready, but nothing specific for Java 7.

¿Fue útil?

Solución

Spring 4 provides very good support for Java 8 version. It means that they have good support for Java 7 too. If you are planning to use Spring 4 with Java 7 or 8, there should not be any issues. It will be perfectly matching. However, Spring 4 has upgraded their framework API compatible with Java 8 code which has lot of improvements in the language like Lambdas, etc.

It is always backwards compatible and you need not worry anything since more than. 90% of the project will be using Java 6 or 7 for the next couple of years.

My advice is that, if you could start your project with Java 8, that is good for the future since migrating later will have more changes with syntax of the new Apis. Also this is the information provided by Spring team about the Java 8 support on Spring:

Java 8 is a perfect fit for Spring's programming model. We believe that the combination is very attractive, with Java 8 offering elegant language features and library improvements for immediate use with typical Spring APIs. In fact, Spring Framework 4.0 is the first fully Java 8 enabled application framework in the industry. We went the extra mile to provide everything that is necessary to start developing Spring applications on Java 8 today, even before the production launch of Java 8 in March.

also I have found useful details in the spring documentation http://docs.spring.io/spring/docs/current/spring-framework-reference/html/new-in-4.0.html.

They have clearly mentioned as

However, for newly started development projects based on Spring 4, we recommend the use of Java 7 or 8.

Note that minimum supported Java version for Spring 4 is raised to Java 6.

Hope this answer helps you.

Otros consejos

I've stumbled on a few problems... namely if you're compiling with -Werror on and use something like the PropertySource annotation, that imports a Java 8 class Repeatable and fails to allow your project to successfully compile. If you avoid these classes you're ok, but then.. you're not using the latest spring 4 functionality then.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top