Introduction to Spring Framework
What is Spring framework?The Spring framework is an Open Source framework. It provides the light-weight framework to develop maintainable and reusable enterprise applications. It provides all the services of enterprise application using programmatic and declaratively.
It works with all tier software application layers. It is non-invasive (does not force to extend any class or implement any interface) and handles the infrastructure so developer only focuses on their business logic. It is used to develop maintainable and reusable enterprise applications.
It provides very simple and rich facilities to integrate various frameworks technologies, and services in the application. Spring enables you to enjoy the key benefits of J2EE, while minimizing the complexity encountered by application code.
Spring3 can be describe in two ways :Container :Spring framework can be describe as light-weight container. Because it creates the components of your application and the components are children of the container. The installation, configuration, start and stop kind of activities are not associated with the container. You need to add required jar files in project classpath.
- Contains and manages life cycle and configuration of application objects
- Manages creation and configuration of each bean and its association with other beans
- But Spring is NOT a traditional heavyweight J2EE container
- It provides components to build common parts of applications, such as data access support, MVC support, and many others.
- Makes it possible to configure and compose complex applications from simpler components
- Provides infrastructural functionality, leaving only development of application logic to programmer
Problems with Traditional Approach to J2EE application
- J2EE applications contain excessive amounts of "plumbing" code to use services.
- Many J2EE applications use a distributed object model where this is inappropriate
- The EJB component model is too complex to develop and deploy on Application Server
- The unit test of J2EE applications are very hard
This explains the need for Spring framework
Why Spring over EJB?
- Provides nearly all services provided by EJB container
- Allows development of code that is cleaner, more manageable and easier to test
- Lightweight container
- App components not required to implement, extend or use any Spring-specific classes or interfaces (non-invasive)
Why Spring is so popular?The essence of Spring is in providing enterprise services to Plain Old Java Objects (POJOs) non-invasively
Believe it or not;.With Spring, you can
- Make a Java method execute in a database transaction without having to deal with transaction APIs
- Make a local Java method a remote procedure without having to deal with remote APIs.
- Make a local Java method a management operation without having to deal with JMX APIs.
- Make a local Java method a message handler without having to deal with JMS APIs.
HistoryDeveloped in 2004 by Rod Johnson, an experienced J2EE architect.
- Spring 2.0 – October 2006
- Spring 2.5 – November 2007
- Spring 3.0 – February 2009
- Spring 3.1 – February 2012