SpringSource Spruce Up Spring MVC as Spring Framework 3.2 Goes GA
VMware's SpringSource team has released the GA version of Spring Framework 3.2, exactly one year after 3.1. The new release emphasises the Spring MVC web framework, which recently came out top in our JVM web framework research, with new features including:
- Asynchronous MVC processing on Servlet 3.0, with Spring MVC handler methods being able to return Callables and DeferredResults
- A ContentNegotiationStrategy is now available for resolving the requested media types from an incoming request. The available implementations are based on the file extension, query parameter, the 'Accept' header, or a fixed content type. Equivalent options were previously available only in the ContentNegotiatingViewResolver.
- A new @MatrixVariable annotation which adds support for extracting matrix variables (name-value pairs within path segments) from the request URI.
Improvements have been made to testing, with the inclusion of the formerly-standalone Spring MVC Test project, and support for loading WebApplicationContexts in the TestContext framework. There are a number of blog posts and tutorials (one, two, three) which describe the testing of Spring MVC projects in more detail.
With this update Spring now allows for @Autowired and @Value to be used as meta-annotations, so that a developer can build custom injection annotations in combination with specific qualifiers. You can also build custom @Bean definition annotations for @Configuration classes, e.g. in combination with specific qualifiers, @Lazy, @Primary and so on.
Elsewhere, SpringSource has fine-tuned concurrent data structures in many parts of the framework. In addition the firm has updated the versions of CGLIB and ASM (both of which come as inlined dependencies with Spring now) to versions 3.0 and 4.0 respectively, and has added AspectJ 1.7 support.
Finally, Spring provides an early CacheManager adapter for JCache, building against the JCache 0.5 preview. Full JCache support is expected next year, when Java EE 7 is released.
In terms of future plans Spring project lead Juergen Hoeller told InfoQ
The next generation of the Spring Framework is going to focus on Java SE 8 support, both language and API wise, as well as support for selected specifications from the Java EE 7 umbrella. We will also take Spring's web support to the next level, driven by asynchronous HTTP I/O processing and WebSockets, and revisit our support for alternative languages such as Groovy 2.
A full list of the enhancements is available in the documentation's New Features and Enhancements in Spring Framework 3.2 section. The Spring Framework 3.2 binary build is available to download from the project's Community Downloads page. The Apache 2 licensed source is downloadable from GitHub, and can be built via the new Gradle-based build which replaces the older Ant+Ivy system.
Tom Gilb & Kai Gilb Jan 26, 2015