Spring Framework is an open source application framework for java based platforms. It is used to build Web applications along with the use of Java Enterprise Edition (J2EE). It is very popular in Java Developer Community. It is highly lightweight and occupies only 2MB of storage space. It uses POJO (Plain Old Java Object) Development model to create faster J2EE applications.
Components of Spring Framework and its Architecture
Spring Framework architecture is a modular type of architecture. That means it is made up of multiple modules in the containers mentioned below:
- Test: It is the first and the lowest layer of Spring Architecture
- Core Container: It contains modules like Core, Beans, Context, and Regular Expressions etc.
- AOP (Aspect Oriented Programming), Aspects and Instrumentation
- Data Access integration: It contains modules like JDBC, ORM (Object Relational Mapping), OXM (Object XML Model), JMS (Java Messaging Service) and Transaction
- Web: This layer contains web connectivity and client-server connection modules like MVC, Web Socket Module, Web Portlet.
Advantages of Spring Framework
- Easy testing capabilities
- Lightweight and non invasive
- Fast Development Framework like JTA, JDBC, JMS etc. can be used along with Spring
- Powerful Abstraction implementation
- High validation and transaction support
Key features of Spring Framework
AOP (Aspect Oriented Programming)
AOP is a key element of this framework. In AOP the users are able to handle aspects like caching, logging, security, declarative transactions etc. AOP is used to conduct Aspect Oriented Implementation of Spring framework. Similar to a class in OOP (Object Oriented Programming), AOP is based on the concept of an Aspect.
DI or Dependency Injection keeps the Spring Framework application classes independent from other Java classes in the programming interface or API. We are able to integrate these independent classes by using DI. ‘D’ means Dependency which is an association of two classes. ‘I’ stands for Injection which is implementation of other classes with the help of the previous class.
Basic Steps to create a Application using Spring Framework
- Create a Java project in any IDE available like Eclipse IDE or NetBeans
- Install and add all the required Spring Framework Libraries that will be used in Spring Implementation
- Create Source Files for the Java program created in the 1st step
- Create Bean Configuration page inside the SRC directory to bind the classes together
- Run the program and deploy the application