tags:

views:

1714

answers:

7

Spring Framework 3 seems to be right around the corner, but the GA version is 2.5.6.

If this is the first time I'm approaching the subject, should I start with the stable version, or should I start with the new version and save myself migration issues?

How different is version 3 from version 2? How near is Spring 3?

+8  A: 

I would start with the stable version. Less bugs, more documentation, more stable and easier to find answers to issues.. Spring 3 won't be vastly different. There is a Spring 3 reference manual but it's incomplete for the changes. Also, since Spring 3 is only on a milestone release (M3), it's still subject to change.

You can read What's New in Spring 3.0 but I imagine a lot of it won't mean anything to you yet.

cletus
+10  A: 

I would start with Spring 3 for various reasons:

  • full Java 5 support (this is main reason for adopting Spring 3 for me)
  • Spring MVC support is deeply change between spring 2 and 3 (notably REST support). Learning spring 2 MVC is not a far-seeing imho.
  • new module organization (if you start with Spring 3, you don't need to migrate packages in the future)
  • OSGI compabitiliy
  • Ivy support

You don't need to worry about bugs or incomplete documentation since you are still learning the framework concepts. In conclusion, learning Spring 3 instead Spring 2 is a far-seeing choice.

However a very good introduction to Spring 2.x is given by Spring in Action, an excellent book about the subject.

dfa
+1  A: 

Start with Spring 2 for the simple reason that if you are doing a project right now, it will be in Spring 2 and not Spring 3. I've been exploring Spring 3 for a while but working in Spring 2 and have to say that they have added a lot of nice new features in Spring 3.

This actually makes working in Spring 2 annoying because I look for the things and they aren't there. It's a little annoying - spare yourself this, I don't think you'll have any trouble learning Spring 3.

stevedbrown
+1  A: 

If you're learning it to start a new project that's going to be starting when Spring 3 is out learn Spring 3. If you're going to be working on an existing project that's already on Spring 2, learn that. The changes are significant enough that projects currently using 2.x are not going to jump immediately.

Sam DeFabbia-Kane
+1  A: 

I wouldn't worry too much about the version; probably starting with the actual release (i.e. 2) is better than starting with one that's still in milestone releases. However, Spring 2.5, and particularly Spring MVC, can use two approaches; configuring primarily using XML, or configuring primarily using annotations. Spring is definitely moving in the direction of annotations, so if you get used to using them you should be OK.

JacobM
+5  A: 

It's important to know required java language version:

  • Spring 3 needs java 1.5
  • Spring 2.5 needs java 1.4
  • Spring 2.0 and older works on java 1.3 (if you still work on legacy servers, I recently used Spring 2.0 on WAS 5.0)
Mercer Traieste
good answer! wasn't aware of that...
michel
A: 

It is possible use xml configuration and annotations in the same project.

I've made some project in 2.5 but now would like move to Spring 3.

I understand that is not easy (it is not enough only change library - need re-write code).