Upgrading to Spring 2.5 from a Spring 2.0.x application should simply be a matter of dropping the Spring 2.5 jar into the appropriate location in your application's directory structure.
Whether an upgrade from Spring 1.2.x will be as seamless depends on how much of the Spring APIs you are using in your code.
Spring 2.0 removed pretty much all of the classes and methods previously marked as deprecated in the Spring 1.2.x codebase, so if you have been using such classes and methods, you will of course have to use alternative classes and methods.
With regards to configuration, Spring 1.2.x style XML configuration is 100%, satisfaction-guaranteed compatible with the Spring 2.5 library. Of course if you are still using the Spring 1.2.x DTD, then you won't be able to take advantage of some of the new Spring 2.0 functionality , but nothing will blow up.
Changes required
1. Supported JDK versions
As of Spring 2.5, support for JDK 1.3 has been removed, following Sun's official deprecation of JDK 1.3 in late 2006.
If you haven't done so already, upgrade to JDK 1.4.2 or higher.
If you need to stick with an application server that only supports JDK 1.3, such as WebSphere 4.0 or 5.0, use Spring Framework version 2.0.7/2.0.8 which still supports JDK 1.3.
2. Jar packaging in Spring 2.5
As of Spring 2.5, Spring Web MVC is no longer part of the 'spring.jar' file.
Spring MVC can be found in 'spring-webmvc.jar' and 'spring-webmvc-portlet.jar' in the lib/modules directory of the distribution.
Furthermore, the Struts 1.x support has been factored out into 'spring-webmvc-struts.jar'.
Note :
The commonly used Spring's DispatcherServlet is part of Spring's Web MVC framework.
As a consequence, you need to add 'spring-webmvc.jar' (or 'spring-webmvc-portlet / struts.jar') to a 'spring.jar' scenario, even if you are just using DispatcherServlet for remoting purposes (e.g. exporting Hessian or HTTP invoker services).
Spring 2.0's 'spring-jmx.jar' and 'spring-remoting.jar' have been merged into Spring 2.5's 'spring-context.jar' (for the JMX and non-HTTP remoting support) and partly into 'spring-web.jar' (for the HTTP remoting support).
Spring 2.0's 'spring-support.jar' has been renamed to 'spring-context-support.jar', expressing the actual support relationship more closely.
'spring-portlet.jar' has been renamed to 'spring-webmvc-portlet.jar', since it is technically a submodule of Spring's Web MVC framework.
Analogously, 'spring-struts.jar' has been renamed to 'spring-webmvc-struts.jar'.
Spring 2.0's 'spring-jdo.jar', 'spring-jpa.jar', 'spring-hibernate3.jar', 'spring-toplink.jar' and 'spring-ibatis.jar' have been combined into Spring 2.5's coarse-granular 'spring-orm.jar'.
Spring 2.5's 'spring-test.jar' supersedes the previous 'spring-mock.jar', indicating the stronger focus on the test context framework.
Note that 'spring-test.jar' contains everything 'spring-mock.jar' contained in previous Spring versions; hence it can be used as a straightforward replacement for unit and integration testing purposes.
Spring 2.5's 'spring-tx.jar' supersedes the previous 'spring-dao.jar' and 'spring-jca.jar' files, indicating the stronger focus on the transaction framework.
Spring 2.5 ships its framework jars as OSGi-compliant bundles out of the box.
This facilitates use of Spring in OSGi environments, not requiring custom packaging anymore.
3. XML configuration
Spring 2.0 ships with XSDs that describe Spring's XML metadata format in a much richer fashion than the DTD that shipped with previous versions. The old DTD is still fully supported, but if possible you are encouraged to reference the XSD files at the top of your bean definition files.
One thing that has changed in a (somewhat) breaking fashion is the way that bean scopes are defined.
If you are using the Spring 1.2 DTD you can continue to use the 'singleton' attribute.
You can however choose to reference the new Spring 2.0 DTD which does not permit the use of the 'singleton' attribute, but rather uses the 'scope' attribute to define the bean lifecycle scope.
4. Deprecated classes and methods
A number of classes and methods that previously were marked as @deprecated have been removed from the Spring 2.0 codebase.
For a comprehensive list of changes, consult the 'changelog.txt' file that is located in the top level directory of the Spring Framework distribution.
The following classes/interfaces have been removed as of Spring 2.0 :
- ResultReader : Use the RowMapper interface instead.
- BeanFactoryBootstrap : Consider using a BeanFactoryLocator or a custom bootstrap class instead.
5. Apache OJB
As of Spring 2.0, support for Apache OJB was totally removed from the main Spring source tree.
The Apache OJB integration library is still available, but can be found in it's new home in the Spring Modules project.
6. iBATIS
Please note that support for iBATIS SQL Maps 1.3 has been removed.
If you haven't done so already, upgrade to iBATIS SQL Maps 2.3.
7. Hibernate
As of Spring 2.5, support for Hibernate 2.1 and Hibernate 3.0 has been removed. If you haven't done so already, upgrade to Hibernate 3.1 or higher.
If you need to stick with Hibernate 2.1 or 3.0 for the time being, keep using the Spring Framework version 2.0.7/2.0.8 which still supports those versions of Hibernate.
8. JDO
As of Spring 2.5, support for JDO 1.0 has been removed.
If you haven't done so already, upgrade to JDO 2.0 or higher.
If you need to stick with JDO 1.0 for the time being, keep using the Spring Framework version 2.0.7/2.0.8 which still supports that version of JDO.
9. UrlFilenameViewController
Since Spring 2.0, the view name that is determined by the UrlFilenameViewController now takes into account the nested path of the request.
This is a breaking change from the original contract of the UrlFilenameViewController, and means that if you are upgrading from Spring 1.x to Spring 2.x and you are using this class you might have to change your Spring Web MVC configuration slightly.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.