Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What are the main advantages of the Spring Framework?

 
Greg Funston
Ranch Hand
Posts: 81
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, welcome to the JavaRanch. I am a new Programmer and I have seen the Spring framework and spent a little time learning it. I am not a "Spring warrior" so to speak and my exposure to different frameworks is limited.

1. What are the main advantages to Spring?
2. Why should I chose Spring over its competitors?
3. Does the advantages of learning the Spring framework come with any drawbacks/limitations?

I look forward to your replies and hopefully having time to read your book sometime soon.

Thanks.

Greg Funston SCJP
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Funston wrote:
1. What are the main advantages to Spring?
2. Why should I chose Spring over its competitors?
3. Does the advantages of learning the Spring framework come with any drawbacks/limitations?


I'm certainly going to answer this with some bias, so I welcome others to chime in with their thoughts. That said...

The primary benefits of the Spring framework (IMO) are loose-coupling with dependency injection, declarative programming (transactions, security, etc) with AOP, and a POJO-oriented model for simpler development. Taken together, these foster a development model that is geared toward solving problems rather than satisfying the whims and demands of a server.

On reason to choose Spring over its competitors is because it is the de facto standard for enterprise Java development. But that means nothing, really...what's important is why it is chosen by so many projects--because of the benefits I mentioned above, plus because the Spring "universe" spans several areas of Enterprise Java development. And, although Spring is far-reaching, that doesn't mean you *must* use it for everything. You are certainly free to pick-n-choose which parts of Spring you want to use and which parts you'll rely on some other mechanism.

I'm not sure I understand the third question...learning Spring (or anything really) expands your mind and way of thinking. I don't see any drawbacks or limitations to that, even if you find Spring isn't for you. If you're asking of Spring has any disadvantages...well, as I said, I approach this question with a bias and have to say "no".

At one time, the major drawback of Spring was that it required that you write *PAGES* of XML, even for the simplest things. But that's no longer true. Spring has a healthy mix of configuration options including a few approaches for annotation-driven development and yes, XML.
 
Greg Funston
Ranch Hand
Posts: 81
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I appreciate the time it took to answer my questions. Just as a note, I do understand that your opinion is somewhat biased but that is the same as a Jaguar salesman etc. Still we always ask questions to those people who are biased but still have an in-depth knowledge of their products. Sometimes they have views which others do not express which is why we buy books from them as well. I look forward to reading the questions and answers posted in the promotion this week. Congratulations on your book as well. I know it takes a lot of hard work even to do the promotions.

Cheers,
Greg Funston SCJP
 
Debbie Watson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
loose coupling means exactly what ?
 
kuldeep sidhu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Debbie Watson wrote:loose coupling means exactly what ?

In spring you can inject dependencies at runtime
e.g

In the above snippet Class Traveler and Car are tightly coupled. You are creating a car object while creating a Traveler object. In the above case if you want to implement the same case for other vehicle either you need to create new class or new method for that type of vehicle.You cant directly use the same method



In this case you can provide object of Vehicle type. Hence the same method moveVehicle() in Main class will work for all type of vehicles.
Above example shows loose coupling between Traveller and Vehicle class.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic