post

1. What is Spring

Spring is an open-source Framework who simplifies development complexities of java-based enterprise applications. It provides infrastructural support at application level so that developers can focus only on business logic.

2. Framework of frameworks

Also Spring can be thought as a framework for frameworks" because Spring supports and facilitate using a wide range of frameworks such as Hibernate, Struts, etc.

3. Spring Main Approach

Spring at its core, is a dependency injection container which is a pattern for developing decoupled applications. For example if you want to has an object of class ClassA which implements interface MyInterface in class ClassB one option is to new it (ClassA a = new(ClassA);) in class ClassB. This way we would couple class B with implementation of MyInterface and loose the flexibility of managed switching implementation from ClassA into another one. In the other hand Spring manage lifecycle(creation and destroy) of objects (beans) itself, and so developer needs only to work with POJOs and you do not need an EJB container such as an application server. So what happens if somebody, say Spring, can wire these dependencies?

4. Spring Magic

Now it's time to understand how Spring simplifies development process. Spring introduces a descriptive and conventional way in which developer can determine how things must be wired together. For better understanding below is an example for inject dependency using XML while using Spring:
Or using JAVA simply in another way you can annotate a variable of ClassA in ClassB:

5. Spring Features

Spring provides many features such as MVC, Aspec-Oriented-Programming, Batch, Integration, etc. That their explanation is beyond the scope of this article. This article aims to make a short but well understanding of Spring framework essence.

Leave a Reply

Your email address will not be published. Required fields are marked *