aspose file tools*
The moose likes Spring and the fly likes Advantages to converting 2.x to 3? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Advantages to converting 2.x to 3?" Watch "Advantages to converting 2.x to 3?" New topic
Author

Advantages to converting 2.x to 3?

Galen Palmer
Greenhorn

Joined: Aug 09, 2007
Posts: 29
I've got various old Spring 2.x based apps where the only annotations are for Hibernate and all the other bean wiring is written into the root-servlet.xml file. Is it possible to incrementally migrate an app towards the 3.x way of doing things? Or, is it worth the time to migrate the app all in one go?
Arnaud Cogoluegnes
author
Greenhorn

Joined: Jan 26, 2010
Posts: 10
with Spring 3.0, you'll get the latest bug fixes and all the new features. The upgrade should be just a JAR drop-in, so you can at least try!
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 467
Here's a quote from a blog post by Juergen Holler which contains the main new features in spring 3
* Spring expression language (SpEL): a core expression parser for use in bean definitions, allowing for references to nested bean structures (e.g. properties of other beans) as well as to environmental data structures (e.g. system property values) through a common #{…} syntax in property values.
* Extended support for annotation-based components: now with the notion of configuration classes and annotated factory methods (as known from Spring JavaConfig). Spring also allows for injecting configuration values through @Value expressions now, referring to configuration settings via dynamic #{…} expressions or static ${…} placeholders.
* Powerful stereotype model: allows for creating 'shortcut' annotations through the use of meta-annotations, e.g. for default scopes and default transactional characteristics on custom stereotypes. Imagine a custom @MyService annotation indicating @Service, @Scope("request") and @Transactional(readOnly=true) through a single annotation.
* Standardized dependency injection annotations: Spring 3.0 comes with full support for the JSR-330 specification for Dependency Injection in Java – annotation-driven injection via @Inject and its associated qualifier and provider model, as an alternative to Spring's own @Autowired and co.
* Declarative model validation based on constraint annotations: Spring-style setup of a JSR-303 Bean Validation provider (such as Hibernate Validator 4.0). Comes with an annotation-driven validation option in Spring MVC, exposing a unified view on constraint violations through Spring’s binding result facility.
* Enhanced binding and annotation-driven formatting: Converter and Formatter SPIs as an alternative to standard PropertyEditors. Formatting may be driven by annotations in a style similar to JSR-303 constraints, e.g. using @DateTimeFormat. Also, check out the new mvc namespace for convenient setup of formatting and validation in Spring MVC.
* Comprehensive REST support: native REST capabilities in Spring MVC, such as REST-style request mappings, URI variable extraction through @PathVariable parameters, and view resolution driven by content negotiation. Client-side REST support is available in the form of a RestTemplate class.
* Rich native Portlet 2.0 support: Spring MVC fully supports Portlet 2.0 environments and Portlet 2.0’s new event and resource request model. Includes specialized mapping facilities for typical portlet request characteristics: @ActionMapping, @RenderMapping, @ResourceMapping, @EventMapping.
* Object/XML Mapping (OXM): as known from Spring Web Services, now in Spring Framework core. Marshalling and Unmarshaller abstractions with out-of-the-box support for JAXB 2, Castor, etc. Comes with integration options for XML payloads in Spring MVC and Spring JMS.
* Next-generation scheduling capabilities: new TaskScheduler and Trigger mechanisms with first-class cron support. Spring 3.0 comes with a convenient task namespace and also supports @Async and @Scheduled annotations now. This can be executed on top of native thread pools or server-managed thread pools.
Beyond those big themes, there are hundreds of refinements in the details which you will particularly appreciate when upgrading from Spring 2.5. Check the changelog and the javadocs…

You can also take a look at this presentation on infoq


Visit my blog: http://jnassef.blogspot.com/
Galen Palmer
Greenhorn

Joined: Aug 09, 2007
Posts: 29
I appreciate the responses, but I guess I didn't make the main point of my question clear: when migrating an existing app is it worth it to try and "go the 3.x way" or can a legacy app be maintainable in a partially migrated state and still take advantage of all the 3.x goodness?
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 467
Well, Migrating to spring 3 is not painful at all. Just drop in the new jars, and change the XML to use the new XSD versions, and that's it (in most cases). Whether you change your application or not is up to you. I'll go for upgrading to spring 3, then migrating the legacy code a piece by piece.
 
 
subject: Advantages to converting 2.x to 3?