5 reasons to upgrade Spring from 2.0 to 2.5
The 2nd anniversary of the announcement that Spring 2.5 was available is just around the corner. There are many reasons to upgrade the SpringFramework from 2.0 to 2.5. Spring 2.5 is designed as a drop-in replacement for 2.0 so there are no valid technical arguments for not upgrading.
Release Announcement: 19/11/2007
I don’t want to review all the improvements that were made, but thought it would be interesting to pick a favorite feature and explain why for me its the best feature. Perhaps some of the few remaining projects out there will move up and start taking advantage of this fantastic framework. After all, with the release notice for 3.0 RC1 back in September soon there will be reasons to upgrade again!
I have seen a few of these upgrades through now, and so far they have all been straightforward. The work is not in the upgrade, its in the work to use the features. This can be done over time to reduce the impact. The last one I did for instance was mainly re-factors to use generics which is never a bad idea, and conversion of tests to use the new annotation based Junit 4 framework.
So, my top 5 candidates for Favorite Upgrade Feature.
- Takes advantage of new language features in Java 5 and 6. This includes adherence to JDBC 4.0, JTA 1.1, JavaMail 1.4 and JAX-WS 2.0. The addition of Generics in the high level API is a particular boon. The core is still compatible with Java 1.4, but the addition of Generics in the higher level API’s means you can take full advantage of generics in most of the important areas. If your already on Java 5 you can get rid of masses of warnings, or all those dangerous suppressions. The code gets cleaner and more of your casts will be checked upfront. For me this is a huge development productivity enhancement.
- Greater use of annotations in configuration. This is particularly useful for wiring of web services and the MVC controller. The new @Qualifier annotation is essential when Auto-wiring beans and needing to choose from multiple beans of the same type. Not such a massive deal for me, as I like the way that xml provides a map of the application. Well if its well structured it does. There are some places that annotations are excellent though and the MVC layer is just that, as it allows you to see exactly what a controller is doing. What it responds to, and how it redirects. The new way to implement the get, post, redirect pattern is awesome more detail in the MVC API Documentation.
- Better JDBC Support including better handling of errors and the new SimpleJDBCTemplate. Oh! and the addition of named parameter support is very handy indeed.
- New annotation based support the Junit and Nunit integration testing. This includes new classes for spring integration testing, and removes the need to extend from the TestCase framework. The net result of this is greater test flexibility, easier configuration and the ability to easily inject fixture dependency and share test support utilities.
- Increased performance. Not sure what the specific changes are but I quote from their website: We recommend upgrading to Spring 2.5 from all previous Spring 2.0.x versions in order to benefit from the new features as well as the significant performance enhancements that Spring 2.5 has to offer.
For me the winner is point 1, Java 5 language features, but it was a hard decision. I have seen an incomprehensible test framework re-factored into something manageable. It was made possible by point 4. The simplicity these two features bring to the code should be argument enough to begin your upgrade in the next iteration. Go for it!
Comments are closed.
