http://en.wikipedia.org/wiki/Spring_framework
Look at the the "Dependency Injection" section.
Follow this logic:
- Eorget about Spring for a moment.
- Think about an application with many classes, where -as usual- each class depend on many others.
- Think about how you would instantiate those classes.
- Soon you realize that the way they are coupled together, makes it a nightmare to instantiate them.
- Moreover, if you are unit testing, you want to make it flexible enough so that you can change those dependencies with mock objects.
- You realize that factories are a good way of abstracting and centralizing those object creations.
- You think about centralizing all this, so that you only worry about the functionality of the classes, and let "something else" worry about all that creation boilerplate.
- That's when Spring comes. It's a centralized container for those objects. Those objects are just POJOs (or beans). Pretty simple.
- Spring is much more than a container, but that's for the dependency injection related stuff.
Cheers.
http://forum.springsource.org/showthread.php?113923-Why-use-Spring-Framework
No comments:
Post a Comment