why use spring? [closed]
I am very much confused whether i should use spring
Reason - I want to develop a loosely coupled code which i think can b开发者_如何学JAVAe developed using Factory pattern and interfaces... and dependency injection can be implemented without using spring too...(by passing parameters).. why should i use spring then ?? Which are the other benefits of spring which i am unaware of..It would be really helpful if you could give me code samples comparing spring codes and simple java code(interfaces)...indicating how spring code is better...
Thanks
You must go through Martin fowler's article http://martinfowler.com/articles/injection.html
Spring offers many services other than its IOC container. Declarative transactions, JMS, Timing/Scheduling, AOP, a MVC framework, etc.
Whether or not it's the right technology for your project depends on what exactly your project requirements are, and the environment in which it will be run.
Spring, among a lot of other things, is a library/framework for enabling dependency injection. You are welcome to code your own dependency injection library/framework and use that, thereby not requiring Spring.
If you create a powerful, annotation based, dependency injection library/framework, chances are, you'll come to something very similar to what spring already is.
精彩评论