Spring is an open source Java based application development framework introduced by Rod Johnson. Spring is modular and light weight framework with IoC container, Struts, Hibernate integration support, full featured AOP and MVC support, etc.
A simple Spring application is like any Java application. The only change is that in Spring applications programmers do not need to write Java code to create beans, instead the bean creation rules are configured in an XML file and the Spring IoC container creates and manages the bean. So A simple Spring application additionally contains the bean configuration XML file and jar files for Spring Core and Spring Beans module.
Spring configuration file is a XML file that contains the configuration metadata for the beans. The Spring IoC container instantiates, configures and assembles the beans by reading configuration file. Spring Framework consists of about 20 modules. These modules are grouped into five layers:
Core Container Layer
- Spring Coremodule
- Spring Beanmodule
- Spring Contextmodule
- Spring Expression Languagemodule
Data Access/Integration Layer
- Spring JDBCmodule
- Spring ORMmodule
- Spring OXMmodule
- Spring JMSmodule
- Spring Transactionmodule
- The AOP layer consists of Spring AOP Alliance module.
- The Test layer consists of String Test module.
Benefit of Spring Framework
The primary benefits of the Spring framework (IMO) are loose-coupling with dependency injection. But it provide other facility to develop application. These are :
- Spring is free and open source framework.
- Spring is a light weight framework and uses less memory and CPU for loading beans.
- Spring is modular so we can use those modules required for an application and leave other modules.
- Spring provides good support for inversion of control (IoC) or dependency injection (DI).
- Spring provides full featured MVC andAOP implementation.
- Spring helps to create loosely coupled applications.
- Spring is not dependent on any Application server.
- Spring supports easy integration with other frameworks like Struts, Hibernate, etc.
- Spring supports declarative transaction management, JDBC, web services, security, logging, etc.