wood burning stoves
The moose likes Spring and the fly likes Spring 3 in Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring 3 in Action" Watch "Spring 3 in Action" New topic

Spring 3 in Action

paul nisset
Ranch Hand

Joined: May 13, 2009
Posts: 201
I've been working my way through your Spring 2.0 book and am able to see certain advantages of using Spring.
The learning curve is not one of them.
It also makes testing more of a pain in that you have to recreate all the Spring managed dependencies .

Does spring 3 provide any significant benefits over the previous versions ? I'm trying to decide whether it's worthwhile investing time learning Spring3 or whether it is just hype.

Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 471

Well, I have to disagree on the testing part. Testing is actually made easier using spring, not harder. Significant benefits of spring 3.0 include simplifications to the MVC framework, task scheduling and configuration, along with the new Spring Expression Language and a lot of other stuff

Visit my blog: http://jnassef.blogspot.com/
Trilochan Bharadwaj
Ranch Hand

Joined: Feb 02, 2009
Posts: 100
Yea especially with stuff like which makes mocking a breeze ... and whats more its native to spring, so if an application is using spring, its really helpful.
Craig Walls
Ranch Hand

Joined: Sep 19, 2003
Posts: 335
Indeed, Spring doesn't make testing harder...it makes it easier.

When you use dependency injection and inject as interfaces, you make it so simple to simply create a mock implementation of those interfaces and wire them into the class you're testing. Keep in mind that in a unit test, your test is doing the wiring of the mocks...not Spring. Spring shouldn't be involved in a unit-testing.

For integration testing Spring can get involved...and for the most part you can (and should) use the same Spring configuration that you use in the production runtime. If there are some things you do *not* want to be real and need to be mocked during the integration test, then let Spring wire them. That's where breaking the context into multiple XML files comes in handy...you can use most of the same XML configs for most of the application...and substitute a test configuration for the parts that need to be mocked up.

One last thought...I said that interfaces make it easy to do mocking...that's true and there are a lot of other good reasons to use interfaces. But using a mocking framework such as Mockito makes it possible to mock out concrete classes. So the interface-oriented approach isn't strictly necessary for mocking...but it's still a good idea in many cases.

Spring in Action - Unleash POJO power in your applications!
Modular Java - Discover the secret weapon to modularity on the Java platform!
XDoclet in Action - Your complete guide to code generation with XDoclet.
I agree. Here's the link: http://aspose.com/file-tools
subject: Spring 3 in Action
jQuery in Action, 3rd edition