Can someone explain me why Sping? (I have gone through so many online tutorials but not happy)
when we should use this??
In a J2EE application at what tiers/levels we can use this??
A list of benefits. And Spring can be in any or all layers that you want.
1) Makes you write POJO classes by adding enterprise abstractions through configuration rather that directly in your code
2) Manages your instances for you, meaning you only need one instance of a Business Service class to support many clients/threads at the same time.
3) Decouples your code so you can swap and change implementations without changing code.
4) Simplifies writing Unit Tests, since you objects are loosely couples and POJOs. Saves you a lot of time writing tests.
5) Allows you to get enterprise integration of Transactions, Security, etc in any environment. Does not require you to be in an App Server, you can deploy anywhere and get those benefits.
6) Simplifies API/specs like JMS, JMX, RMI, Web Services. and JDBC. Removing all the boiler plate code you would have written yourself. For example JDBC, straight JDBC requires a minimum of 17 lines of code just to run a single query. With Spring that is now just one or two lines of code.