It is finally here!!. On 12-December-2013, Spring IO has officially announced that Spring Framework 4.0 GA is available for the production use. Why there is lot of things to talk about Spring 4.0?. It is the major release after Spring 3.0 which has been released on 2009. Also Spring team has transformed to Spring IO with looking beyond just a Java framework, their road maps and projects are not just only for the Java developers, it is more a complete enterprise solution.
Coming back to the release of Spring 4.0, there is plenty of major changes introduced in this release. Here I summarize the prominent features.
Spring 4.0 New Features
1. Deprecated Methods and Packages
With this new release, all the deprecated methods and packages are dropped and no more supported. This should be the challenging point for those who want to migrate their old spring applications to the new version. As a caution, if you are running the old spring application, then first thing to get rid of your deprecated APIs before migrating to the latest version.
Look at API Differences to know what is changed in new release.
2. Java 8 Support
This is the first version supports all the features of Java 8. Spring team proudly announces that they have fixed all the issues with the Java 8 compatibility and it is ready to use with Java 8 once Open JDK 8 is released on March 2014. Also another update is that, Spring 4.0 has increased the minimum recommendation to Java 6.0. Also it states that any new project recommended to use the Java 7.0 for their projects with Spring 4.0. It still supports the lower version Java 6 and 7 without any problem.
3. Java EE 6 and 7
Java EE 6 or above is now considered the baseline for Spring Framework 4, with the JPA 2.0 and Servlet 3.0 specifications being of most suitable. It is possible to run your application in Servlet 2.5, but it is recommended to use Servlet 3.0 environment.
4.Groovy Bean Definition DSL
It is possible to define Spring beans using Groovy DSL. We can use bean definitions at the bootstrap using Groovy. Read this API to get more details.
5. Spring Core Changes
There are lot of changes to the Spring’s core container.
- The @Description annotation has been added for developers using Java-based configuration.
- @Conditional is introduced to conditionally filtering the beans.
- Beans can now be Ordered when they are autowired into lists and arrays. Both the @Ordered annotation and Ordered interface are supported.
- If you are using Spring’s annotation support, you can now write custom annotations that expose specific attributes from the source annotation.
There are much more improvements, I will continue writing in this blog about the new features.
6. Spring Web Module Features
- Most recommended is Servlet 3.0+ environment. If you are using Spring Testing Framework, then Servlet 3.0 compatible JAR is should be in your test classpath.
- There is new @RestController annotation for defining the REST web services. This has the built-in @ResponseBody attribute. This is a specialized version of @Controller.
- Spring provides comprehensive timezone support when developing Spring MVC applications.
7. Testing Features
There are several new features introduced for unit testing and integration testing.
- Almost all the annotations in the spring-test module can now be used as meta-annotations to create custom composed annotations and reduce configuration duplication across tests.
- org.springframework.mock.web package is compatible with Servlet 3.0 .
The above features are only the few of them, I will come up with detailed tutorials on each features. Please subscribe here.