• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why Spring?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know of several groups in our company that are considering implementing Spring. What do you think are the biggest advantages & disadvantages? In other words, why use Spring?
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aaron Diffenderfer wrote:I know of several groups in our company that are considering implementing Spring. What do you think are the biggest advantages & disadvantages? In other words, why use Spring?



Pre EJB 3.0 world the answer to this question would be "Simplicity" in building a full stack J2EE app.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aaron Diffenderfer wrote:, why use Spring?


In case you want to use dependency injection in your application and make your component less knowledgeable about the others implementation.
 
Author
Posts: 44
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the big picture of software design, Spring helps the software architect build loosely coupled systems.

It does this by having you code to Java interfaces. When you implement the interface with an appropriate Java class, you "configure" the implementation class using either annotations or xml. This is called bean wiring. Behind the scenes, the Spring container makes sure the correct class is plugged in. This is called dependency injection, where the system dependencies are "injected" by the Spring container. The dependencies, therefore, are not hardwired, but specified externally.

The beauty is that you can plug and play implementation classes (for example, you can implement persistence using Spring JDBC, "native JDBC", Spring JPA, native JPA). With JPA (Java Persistence API) you can use EclipseLink, Hibernate, etc.. It also makes it easy to implement different front-end frameworks. I have implemented the same system using both Swing and JSF 2. When you deal with well-designed service modules, this type of reimplementation is straightforward.

The disadvantage is that XML configuration can be verbose. Annotations are generally easier to read, but may be spread out in different source files.

In my opinion, building loosely coupled systems far outweighs any disadvantages.
 
author
Posts: 422
13
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everything that has been said about Spring keeping coupling low is true and is a good message to send.

But so what? Does that mean that it's impossible to write loosely coupled code without Spring? Of course not. Dependency injection can be done by hand or you could choose other DI frameworks and accomplish the same loose-coupling.

What makes Spring special is that it's not *just* the dependency injection and AOP. Beyond that there's declarative security, caching, and transactions. There's cool support for working with scheduled jobs and asynchronous methods. You'll find abstractions for remoting and for JMS. And there's a web framework. And a webflow framework. Keep going and you'll find projects to help with integration (ala the Integrations Patterns book) and batch processing. Step out a bit more and you see abstractions for working with various types of datastores (including NoSQL databases). Keep looking and you'll find support for building mobile web applications, Android apps, and applications that interact with social networks. And then....there's more...but you should get the picture...

Spring has something for most any need...and if something's not there, it's open-source and we'd be pleased to see you contribute it.
 
Ranch Hand
Posts: 136
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Keep looking and you'll find support for building mobile web applications, Android apps, and applications that interact with social networks. And then....there's more...but you should get the picture...



Did you mean there is some support for connecting to FB/FS/Twitter using Spring?
Do you have any chapter in your book dedicated for these?

 
Craig Walls
author
Posts: 422
13
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sujoy Choudhury wrote:Did you mean there is some support for connecting to FB/FS/Twitter using Spring?
Do you have any chapter in your book dedicated for these?



It's not in the book, but yes...Spring Social (http://www.springframework.org/spring-social) enables apps to connect to services such as Facebook and Twitter without having to muck about with the finer details of OAuth or individual provider REST APIs. In fact, I pushed out the 1.0.0.RC2 release of Spring Social tonight! Check it out and let me know what you think.
 
Sujoy Choudhury
Ranch Hand
Posts: 136
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Craig!!!
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Craig sold pretty much, so much of Spring that took me 2 years to figure out, but now I am bowled over by Spring Social. Guys at springsource are doing a good job and we did rather contribute our bit. Infact this is one framework that half the IT projects swear by! I'd like to add the beauty of its Webservices integration which works with nearly all known protocols. Another beauty is it is compartmentalized, you can configure which parts of spring your app needs and send only those to deployment without the overhead of having a 200MB load of jar files that comes with a standards compliant app server!
 
Ranch Hand
Posts: 79
Eclipse IDE Spring Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Though its very well clarified by Craig & others .. would like to add my bit ..
Nice AJAX libraries support, same for web services, almost all good coding practices & design patterns in use, easy to test components, nice use of aspects ....
no need to look beyond !
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the aspects of spring..which i am crazy about..besides the usual..is the effort spring developers take to write code...

There have been a few instances when i have had to extend spring projects (extended spring web services during its infancy)..and the code documentation made it a breeze to extend and develop custom features...
 
reply
    Bookmark Topic Watch Topic
  • New Topic