W-JAX 2009: Spring 3.0 und wie es weitergeht

SpringDisclaimer: This entry has been written while listening to the talk. Please forgive me any typographical or grammatical errors resulting from this approach.

Eberhard Wolff is going to present both the new features of Spring 3.0 as well as the next steps in Spring development. While I’m not very interested in 3.0 (hey, we at QuinScape developed with Spring 3.0 poster in cooperation with Eberhard Wolff and Software & Support)  I’m always looking forward to new tidbits of information about the next versions – and this is a nice warmup early in the morning 😉

Eberhards talk is structured in three parts:

  • a quick review of the features in Spring 2.5 (especially those important for 3.0)
  • the new features in Spring 3.0
  • the roadmap for Spring 3, milestones, etc.

The most important feature noted in Spring 2.5 is annotation based configuration including autowiring, qualifier and component stereotypes as well as Java EE 5 annotation support. Eberhard noted that contrary to the keynote from yesterday it is rather trivial to use JPA on Tomcat – when you are using Spring. Yes! Eberhard additionally highlighted the power of annotation based programming in cooperation with the Spring test context framework introduced in Spring 2.5. Additionally he showed Spring Web @MVC (annotation based web MVC).

The new features in Spring 3.0 include:

  • Spring 3.0 moves to Java 5. Many API calls will be extended to use generics (e.g. the famous applicationContext.getBean call). java.util.concurrent.Executor is supported. Futures are supported. Application listeners also use generics. Overall these changes are gradual, not a fundamental overhaul so that no huge migration effort will be necessary.
  • Spring 3.0 introduces the Spring expression language (SpEL) which will be usable in many places. BTW, SpEL is a bugfix for the 4th issue ever reported for Spring 😉 SpEL exposes various context attributes depending on your specific context (e.g. JSF, Spring Batch or your own context – which can extend the available attributes with an SPI provided by SpringSource). Another nice use for this feature is to defined expressions in Spring Security that model access rules removing the need to write Java classes for each and every security rule.
  • Spring 3.0 provides REST support. Spring is compatible with JAX-RS (supports it and is supported by it). Additionally Spring Web MVC adds additional REST support in order to provide a more elegant means to use REST (the extension in Web MVC being rather trivial). In Web @MVC this is done by adding parameters to the @RequestMapping expression and providing an @PathVariable annotation for method parameters in order to directly access those parameter values. Another nice convenience is that the controller does not need to know how the data it is returning is going to be rendered. Das Rendering übernimmt der ContentNegotiatingViewResolver, der basierend auf der URL herausfindet, welche Art von Inhaltsrepräsentation gewünscht ist und diese dann liefert. Another nice goodie is etags support. There is also a RestTemplate for supporting REST clients. This can be combined with OXM marshalling.
  • One new feature for me was Scoped Bean Serializability which provides a means to serialize beans from scopes that you normally rather would not want to serialize (e.g. datasources). Basically the mechanism transfers the bean to “the other system” and uses the corresponding local definition on that system.
  • Spring 3.0 adds portlet 2.0 support.
  • Spring 3.0 provides validation support. JSR-303 “validation support” is used as the common ground for this feature.
  • Spring 3.0 supports JSR-330 (dependency injection), JSR-330 being one of the few final JSRs 😉 JSR-330 was developed by SpringSource in cooperation with the Guice people from Google. This allows programmers to annotate classes a Spring-independent way so that annotated classes can be used by more than one DI framework (e.g. both Spring and Guice). Eberhard here commented a little about about how standardization should work in his opinion, e.g. standardizing how things are being done instead of trying to standardize innovation. I wholeheartily agree with this point.
  • Spring 3.0 adds a revised version of Spring object/ XML mapping with a thin simplification API. This API is moved from Spring Web Services to core in order to be able to support XML in REST much better.
  • Spring 3.0 features a revised binding and type conversion infrastructure. Classicaly there has been PropertyEditor support, with 3.0 features from Spring Webflow will be moved to core in order to provide enhanced support.
  • One of the larger additions is the support for Spring JavaConfig, as presented in my talk yesterday.
  • Spring 3.0 adds meta annotations. This is a very nifty feature that allows to annotate annotations (yes, you read that correctly). Spring 3 memorizes which annotations contain other annotations and uses them transitively. In this way you can provide powerful shortcuts for abstractions by e.g. defining an @MyServiceType annotation that includes @Transactional, @Service and @FooBar. A very nice idea that I personally like so much that I would love to see it included in the standard JDK as a retention or inheritance type.
  • Spring provides partial Java EE 6 support with features for JPA 2.0 and JSF 2.0. Java EE 6 will not yet be fully covered since Java EE 6 standardization still needs some time and SpringSource is not going to wait with 3.0 until that process is finished.
  • Spring 3.0 is prepared for JSR-236 “Concurrency Utilities for Java EE” and thus provides both a scheduling namespace and a major overhaul of the scheduling API.
  • JUnit 3.8 as a test framework will be deprecated.
  • Commons attributes support, the traditional TopLink API and the sub-class style support for Struts 1.x will be removed.
  • Some helper classes will be deprecated.
  • The class hierarchy lying below SimpleFormController will be deprecated (basically everything concerned with the old way of form handling).

No major migration efforts except for in the build process (due to the new Maven structure and module composition) are expected. Spring 3.0 RC1 is out, RC2 will appear very soon, maybe even today. After Spring 3.0 RC3 Spring 3.o final will appear – hopefully still in 2009.

Spring 3.1 will appear in 2010. Planned for Spring 3.1 is

  • full Java EE 6 support if Java EE 6 is final by then (specifically Servlet 3.0, JSR-236 and JSR-330).
  • conversation management for long-running web actions (e.g. over several pages including transaction management, etc). This will not replace Spring Webflow, Webflow will introduce new features and remain focussed on describing those actual flows. Spring Core will only provide the programmatic calls to handle long-running conversations.

Since they have been explained elsewhere (Spring 3 in general, REST) I will not explain these features here in more detail.

As usual Eberhards talk was densely packed with useful information. If you already have heard a few Spring 3.0 talks during 2009 you will have recognized many of those concepts. I had hoped for some more information about the road ahead, but overall the talk was very useful and well done, especially since some new highlights concerning Spring 3.0 were covered.

Comments are closed.