Before we talk about the Spring 3.0 features, it is quite reasonable to walk through a list of features introduced in the Spring 2.5 release. Looking into the Spring 2.5 features would help you to understand the new features in the Spring 3.0 release. In November 2007, the Spring team released version 2.5 of the Spring framework. The significance of Spring 2.5 was that it marked Springís embrace of annotation-driven development. Prior to Spring 2.5, XML-based configuration was the norm. Spring 2.5 introduced several ways of using annotations to greatly reduce the amount of XML needed to configure Spring. Some of these annotations are:
New Features in Spring 2.5
- Annotation-driven dependency injection through @Autowired annotation and fine-grained auto wiring control with @Qualifier.
- Support for JSR-250 annotations, including @Resource for dependency injection of a named resource, as well as @PostConstruct and @PreDestroy for life-cycle methods.
- Auto-detection of Spring components that are annotated with @Component.
- An all-new annotation-driven Spring MVC programming model that greatly simplifies Spring web development such as @Controller.
- A new integration test framework thatís based on JUnit 4 and annotations.
Even though annotations were the big story of Spring 2.5, thereís more:
- Full Java 6 and Java EE 5 support, including JDBC 4.0, JTA 1.1, Java Mail 1.4 and JAX-WS2.0.
- A new bean name pointcut expression for weaving aspects into Spring beans by their name.
- Built-in support for AspectJ load-time weaving.
- New XML configuration namespaces, including context namespace for configuring application context details and a jms namespace for configuring message-driven beans.
Once you are looking for all of those features, you may ask yourself about really what the added value of Spring 3.0 is and what the new features that are added in it. Next paragraph will clarify that.
Whatís new In Spring 3.0?
Spring 3.0 makes the entire spring code base to take advantage of the Java 5.0 technology. The notable Java 5 features like Generics, Varargs, Annotations and other improvements has been extensively implemented with the Spring 3.0 release. This release is one of the major and important release for Spring 3.0.
With all of good stuff in Spring 2.5, itís hard to imagine what could possibly follow in Spring 3.0. But with the 3.0 release, Spring one-upped itself with the continuation of annotation-driven theme and several new features:
- Full-scale REST support in Spring MVC, including Spring MVC controllers that respond to REST-style URLs with XML, JSON, RSS or any other appropriate response. REST support in spring is one of the beautiful addition to the spring framework itself. It make life easier for the developers who want to write the RESTful webservices.
- A new expression language that brings Spring dependency injection to a new level by enabling injection of values from a verity of sources, including beans and system properties.
- New annotations for Spring MVC, including @CookieValue and @Request–Header, to pull values from cookies and request headers, respectively.
- A new XML namespace for easing configuration of Spring MVC.
- Support for declarative validation with JSR-303 (Bean Validation) annotations.
- Support for the new JSR-330 dependency injection specification.
- Annotation-oriented declaration of asynchronous and scheduled methods.
- A new annotation-based configuration model that allows for nearly XML-free Spring configuration.
- The Object-to-XML (OXM) mapping functionality from the Spring Web services project has been moved into the core Spring framework.
Just as important as whatís new in Spring 3.0 is whatís not in Spring 3.0. Specifically, starting with Spring 3.0, Java 5 is now required, as Java 1.4 has reached end-of-life and will no longer be supported in Spring. The above list is brief introduction to what are the new features introduced in this release. Going forward, I would write each feature in detail with the appropriate examples. Looking forward to your comments and feedback after reading the article. If you are looking for any specific feature, please post it in the comments section.