
Spring Tutorial Objectives
• Understand the migration strategy from Spring 1.x and 2.0 to Spring 2.5.
• Learn of possible upgrade issues when moving to Spring 2.5.
• See the new autowire annotations.
• Explore the additional JSR-250 Annotations.
• Learn about Spring 2.5 autodetection and stereotype components.
• Examine annotated MVC controller configuration.
• Learn of the powerful new TestContext Framework for simplified and agnostic unit/integration testing.
• Examine the new AOP pointcut annotation.
• Learn about Spring 2.5 and AspectJ load-time weaving for AOP.
Spring 2.0 added many new features to the Spring Framework. What Spring 2.0 started, Spring 2.5
amplifies. In this chapter, the major new and improved features associated with Spring 2.5 are explored.
Annotations are growing in popularity throughout the Java community and Spring is no exception. Many of
the “new” or “updated” features in Spring 2.5 are annotation-related. Spring 2.5 increases the use of
annotations to help reduce and de-clutter much of Spring bean configuration.
Spring 2.X
• Spring 2.0 was released in October 2006. Spring 2.5 was released in November 2007.
• Spring 2.0 brought significant changes and additions to the Spring Framework.
• While not quite as impactful as Spring 2.0, Spring 2.5 also introduced many new features and some
changes.
• Spring 2.0 and 2.5 changes are summarized at: http://static.springframework.org/spring/docs/2.5.
x/reference/new-in-2.html
• Many of the changes provided with Spring 2.0 have already been introduced in existing text.
• This chapter focuses on those additions found in Spring 2.5. It is not an exhaustive look, but covers
many of the more significant changes.
• In order to provide appropriate background for Spring 2.5 features, some additional 2.0 features are
covered or discussed in greater detail.
• Upgrading to Spring 2.5 from Spring 2.0 should be seamless and backward compatible.
• In order to upgrade to Spring 2.5, simply replace the Spring 2.0 JAR file with the Spring 2.5 JAR file(s).
• However, in Spring 2.5, Spring MVC has been removed from the core spring.jar file.
• Spring Web MVC is now in a separate spring-webmvc.jar.
• The Spring Portlet framework is in a separate spring-webmvc-portlet.jar.
• Also, the Struts 1.x support has been factored out into 'spring-webmvc-struts.jar'.
• Therefore, while the upgrade should be seamless, additional JAR files may need to be added to a project’
s classpath or server’s library.
• All of the Spring JAR files can still be collectively downloaded in a single all inclusive ZIP file from
springframework.org.
• Upgrading to Spring 2.5 from Spring 1.x may not be as seamless.
• Spring 2.0 removed classes marked deprecated in Spring 1.2.x.
• Therefore, code using deprecated 1.x classes will not be compatible with Spring 2.5.
• Spring 2.0 also introduced schema guided XML configuration.
• Use of Spring 1.2.x DTD for configuration does not allow applications to take advantage of many new
Spring 2.0 and Spring 2.5 features.
• Java platform requirements have been updated for Spring 2.5.
• Spring 2.5 now requires JDK 1.4.2 or higher (inclusive of 5 and 6).
• This is consistent with Sun’s End of Life process which deprecated JDK 1.3 December 11th, 2006.
• Therefore, application servers such as WebSphere 4 and WebSphere 5 will not be able to leverage
Spring 2.5.
• Some functionality in Spring 2.5 supports Java 5 and Java 6 features.
• Obviously, the appropriate JDK is required to leverage these features and cannot be utilized in a Java
1.4.x environment.
• Spring 2.5 remains compatible with J2EE 1.3 and higher. Again, some dedicated support has been
added for Java EE 5 environments.
• It should also be noted that for those using Spring with other frameworks, there have been some notable
changes in support.
• Support for Hibernate 2.1 and Hibernate 3.0 has been dropped with Spring 2.5.
• Spring 2.5 now requires Hibernate 3.1 or better.
• JDO 1.0 is also no longer supported and users of Spring 2.5 must move to JDO 2.0.
• Support for iBatis 1.3 has also been dropped in favor of iBatis 2.3 or better.
• Many other libraries that Spring works or integrates with may need to be upgraded with moving to
Spring 2.5!
• A Spring with dependencies downloaded is available from the Spring web site to ensure all appropriate
updates are made.
Spring Tutorial
Table of Contents
Copyright (c) 2008. Intertech, Inc. All Rights Reserved. This information is to be used exclusively as an
Courseware
Training Resources
Tutorials