Spring is most popular application development framework for java enterprise. It is open source Java platform developed by Rod Johnson and released under Apache 2.0 license in June 2003. Spring Framework used to create high performing, reusable and testable code. Spring is framework doesn’t need more memory the basic version of it is around 2MB.
User can develop any Java application by using the features of the Spring Framework; there are extensions for developing web applications on top of Java EE platform. This framework which makes J2EE development easier to use and by enabling a POJO-based programming model it promotes good coding practice.
Benefits of Using Spring Framework:
- Spring is effective in organizing the middle-tier applications.
- The number of classes and packages are substantial because spring is organized in a modular fashion. So user need to worry only about ones they need and ignore the rest.
- Spring supports declarative transaction, formatting, validation and caching.
- Spring works on POJOs which makes easier for injection of test data.
- For data access spring provides a consistent framework, whether by using JDBC or an O/R mapping product like Hibernate, JDO or TopLink implementation.
- Spring provides loose coupling between different modules.
- Spring provides readable codes.
- Spring enhances modularity.
Dependency Injection (DI):
The dependency Injection is a form that removes the dependency of the programs. The regular Java methods are used to inject dependencies like values configuration into application instances of object. In this situation user provide the data from the external source like XML file. This makes code loosely coupled and testing easier.
Example: Class X depends on class Y. The second part, injection which means class Y will be injected into class X by IoC.
Aspect Oriented Programming (AOP):
Aspect oriented programming (AOP) framework is the key components of Spring and AOP is implemented in pure java hence it need not require a separate process of compilation. In spring AOP allows cutting of concerns. The functions that span number of application points are called cross-cutting concerns and these concerns are separate from business logic of application. Example: security, logging, caching and transaction management etc.