This page is regularly updated with the latest information about the Spring 4 framework. It is the most recent stable release for the production applications. Please bookmark this page to have up-to-date information on Spring Framework 4.0 happenings. If you want to add Spring 4 related links or information here, please send to krishnas at javabeat.net.
Spring 3 released on 2009. After a long time, a major release Spring 4 is from Spring community. In this time, there is lot of changes in the spring community. Spring is not just seen as the framework, it is moving beyond that level and seen as a enterprise solution provider.
Get 50% Off the Upcoming REST With Spring Classes over on Baeldung.
Spring is largest Java community in the world. After the acquisition by VMWare, Vmware and EMC has joined and started a initiative called Pivotal. Spring is integrated with the Pivotal team and providing all the Java solutions needed for the Pivotal customers. By looking at the new projects and road map of Spring, it is exciting to see them in the future.
A comprehensive coverage on Spring is updated at Spring Tutorial.
The purpose of this tutorial is to organize all the posts published on Spring 4 and the recent releases after the main release of Spring 4. It is a one stop location where you can find everything about the spring 4. This page will be updated with the latest new and announcement about the Spring 4 framework.
Spring Modules
Spring framework consists of more than 20 modules grouped together. These are largely categorized as Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation, and Test. These are very well depicted in the below diagram.
Spring 4 Releases
Latest : The current version is Spring 4.2.5. The next planned release is Spring 4.3.0 which is scheduled to be released on March 2016.
- New Features in Spring 4.0 (Preview) : Early announcement for the new version on spring framework. It highlights the expected new features to be introduced.
- Spring 4.0 Release Candidate (RC1) Announcement : Release candidate 1 announcement
- Spring 4.0 Release and Features : Much awaited announcement of final release for Spring 4.0 Framework availability to the general public.
- Spring 4.1 Release Announced : New features added are omprehensive web resource handling, Caching support revisited, JMS support overhaul and Performance improvements.
- Spring 4.2 Released : This is another feature release with minor features and enhancements added to the existing features. Some of the notable features are Integration with Hibernate ORM 5.0, Annotation Based application events, bean scripting, @JsonView on STOMP endpoint methods and many other features.
- Spring 4.2.5 Released : It is a maintenance release lots of bug fixes and minor improvements to the spring framework. It provides more stability to the Spring 4 series.
- Spring 4.3 RC1 Released : This is the final release on spring 4 series. The next release will be spring 5.
Spring 4 Features
- Spring 4.0 Environment Setup : This tutorials explains the list of dependencies and configurations required for running the Spring 4 applications.
- Conditional Annotation in Spring 4 : Conditional Annotation Indicates that a component is only eligible for registration when all specified conditions match. The primary objective is to create the bean only after the set of conditions are met.
- RestController in Spring 4 : One of the API improvements is new @RestController annotation which is inherited from the @Controller annotation. Prior to the version 4.0, all the Spring MVC components has to use the common @Controller annotation to mark that as the controller servlet.
-
Spring 4 – Generics Type as Qualifier : One of the improvements introduces in Spring 4 is the generic types as a form of qualifier when injecting Beans. We have several types of methods to determine the closely matching types for the @Autowired annotation. With the Spring 4 release, you can inject the beans using the narrowing of generic types.
- @ControllerAdvice : With the release of Spring 4.0, one of the feature is improvements over the existing @ControllerAdvice annotation. You can narrow the scope of the exception handler. For example, you can declare a exception handler which will handle only the exception thrown by the @RestController , a special type of controller introduced in the Spring 4.0.
- @Profile Annotation : This tutorial explain how to enable profiles in your spring application for different environments. Also this tutorial explains the new improvements in the Spring 4.0 release and how it is different from the older releases.
- Removed Deprecated Packages and Methods : There are lot of deprecated classes and methods from the previous release 3.2.4 has been completely removed in the Spring 4 release. You can find the list of APIs that has been either removed, added and changed in the Spring 3.2.4 to Spring 4.0.0 API differences report.
- Java 8 Support : On March 27, 2014, the Spring community was happy to announce the Spring Framework 4.0.3. The reason why is that it was the first release of the Spring Framework with Java 8 support. You can read some of the Java 8 features are used in the Spring API. One more thing is that Java 6 become the minimum requirement to run the Spring 4 applications.
Spring 4.1 Features
- With the release of Spring 4.1, there is another type of message converter added for Gson library. GSON is another popular JSON parser used similar way how Jackson is used for JSON parsing. This new message converter is implemented as GsonHttpMessageConverter.
- HttpMessageConverter are used for Marshall and Unmarshall Java objects to and from JSON, XML, etc – over HTTP. Generally there are third part libraries available in the community to use for the purpose. Spring has the beauty of identifying the relavent JAR files in the classpath and use for the JSON / XML conversions.
- For this purpose, Spring has in-built HttpMessageConverters for parsing the JSON using Jackson (MappingJackson2HttpMessageConverter – converts JSON (added only if Jackson 2 is present on the classpath) and MappingJacksonHttpMessageConverter – converts JSON (added only if Jackson is present on the classpath). – Read more about HttpMessageConverters.
Spring 4.2 Features
- @EventListener in Spring 4.2 : This tutorial highlights the advantage of using @EventListener in Spring 4.2 for listening to the events. Annotation driven event listener is a new feature introduced in Spring 4.2 version.
- Another good improvement is the ability to bind event listeners to transaction phase. For example, if the transactions are in complete status then that particular event will be triggered. This gives you more flexibility for configuring the events based on transaction status. For that a special type of event listener @TransactionalEventListener is added to spring 4.2. This has exposure to TransactionalPhase which tells spring about when a event has to be fired.
- Better Application Events : Application events are available since the very beginning of the Spring framework as a mean for loosely coupled components to exchange information. One of the most well known usage of application events is the following
- Modern Java Component Design with Spring Framework 4.2 (PDF Presentation by Juergen, Spring Framework Lead)
- Hibernate, Jackson, Jetty etc support in Spring 4.2 : Spring is well-known to actively support the latest versions of common open source projects out there, e.g. Hibernate and Jackson but also common server engines such as Tomcat and Jetty.
Spring 4.3 – Updates
Spring 4.3 is scheduled to be released on Q2 2016. This will be a final major release on Spring 4 series. The following are the list of features that are planned for Spring 4.3. The planning for this release is in early stage, we may gate more updates in the future. We will update the details in the post regularly.
- Spring 4.3 will still be designed for the general Spring 4 system requirements (Java 6+, Servlet 2.5+)
- Also getting prepared for an extended 4.3.x support life until 2019, in particular for users on JDK 6 and 7 but also for applications deployed to older app servers on JDK 8.
- Most important 4.3 plan is to selectively upgrade the third-party dependency libraries: e.g. fully embracing JUnit 4.12, the Jackson 2.5+ APIs, the new JasperReports Exporter API, etc. in order to make Spring’s corresponding integration classes forward-compatible with future generations of those libraries (through avoiding the use of deprecated types and methods).
- Also fine tune the latest features in Spring framework.
Spring MVC
There are lot of new features introduced as part of the web application development.
- Spring 4 REST Example : This tutorial provides a simple example for writing the Spring MVC REST services using the Spring 4 APIs. We have written several articles about the spring 4 features in our previous articles. The REST implementation on Spriing 4 also very much similiar to the previous releases. Here I have provided the sample source code what I have used to implement the REST services.
Spring 4 Books
This section gives you more details on most popular books available in the market for Spring 4 release. If you find any good book or resource for preparing Spring 4, please send me a mail at krishnas at javabeat.net. I will add the details in this post. You can also read our list of Spring Framework Books for a quick reference.
- Spring in Action : Fourth Edition : Spring in Action is the most popular and friendly book for the developers. But, it may not be most suitable for the beginners who are first time learning Spring framework, but it is one of the must have book for spring developers who are working in the real time Spring projects. BUY : Flipkart (India) / Amazon (USA)
Spring 4 Migration
If you ask any developer what is their painful task or challenges in working with a technology, it is obviously adopting latest changes to the technology and migrating their project from older version to the newer one without any issues. Spring developers also faces lot of challenges while migrating from Spring 3.2 to Spring 4.0.
Note that the 3.0.x and 3.1.x lines have been retired already, with no support whatsoever available anymore
- Spring team have published an extensive tutorial about the migration from Spring 3.2 to Spring 4.0.
- This slideshare also would be helpful.
Other Topics
Spring 4 Adoption : There is a nice survey published by Baeldund on Spring 4 Adoption. It is clearly shows that most of the projects are already migrated to the latest release of the Spring framework.
( Source )