Thursday 20 December 2018

why spring framework came in java?

Why Spring Framework?

Below is a chart given which shows the comparison between Spring and various other Frameworks.

It was named Interface 21, as a reference to 21st century and released under Apache 2.0 license.

This was the first milestone release. Spring framework rapidly evolved since this release. Interface21 supported AspectJ parallely with Spring Framework.

New Features were added – extensible XML configs, support for Java 5 and dynamic languages, IoC extension points and AOP enhancements.

New features were added – support for Java 6/ JEE5, annotation configs, component auto-detection in classpath and OSGi compliant bundles.

New features were added – support for reorganized module system, SpEL, JavaConfig, embedded databases, REST support and support for Java EE 6.

Spring Data Commons Project was released. Later in 2012, Rod Johnson left the Spring team.

All Spring projects shifted to Pivotal. New features were added – full support for Java 8, websockets, higher third party library dependencies, groovy DSL for bean definitions.

It was compatible with Java 6, 7 and 8, with a focus on core refinements and modern web capabilities.

It will be the final generation within the general Spring 4 system requirements. 4.3.8 is the current version.

Reasons for Spring Frameworks’s popularity




There are generally three main reasons for Spring Framework’s popularity.




Simplicity

Testablity

Loose Coupling

Let’s discuss these topics in details.




Simplicity: Spring Framework is simple because its non-invasive as it uses POJO and POJI models.<>




POJO (Plain Old Java Objects): A Java class not coupled with any technology or any framework is called “POJO”.

POJI (Plain Old Java Interfaces): A Java interface not coupled with any technology or any frame work is called “POJI”.

Testablity: For writing the Spring application, server is not mandatory. But for struts and EJB applications, you need a server, if you want to test the application. It may need lot of changes in the source and to view those changes, each time you have to restart the server. This becomes tedious and time consuming. In case of Spring Framework, it has it’s own container to run the applications.




Loose Coupling : Spring Framework is loosely coupled because it has concepts like Dependency Injection, AOP etc. These features help in reducing dependency and increasing the modularity within the code. Lets understand this with an example.




Here I have a Bike interface which has a start() method. It is further implemented by three classes, namely : Yamaha, Honda and Bajaj.

1 comment: