Here is my first technoticle (technical +article) to give an introduction of Spring.
Spring released its first version around 5 yrs back and in a short span of time it has gained huge popularity and now it has become one of the main building components of J2EE application. It has progressed from version 1.2 to the present 2.5, and has been adopted in an even wider range of industries and projects.
I believe Spring has gained huge popularity because:
- It is managed by a light weight container known as Inverse Of Control (IOC).
- It is modular in design. The various functionalities are modeled separately such that each module can work as an independently with the support of other modules.
- It has managed to overcome the EJB drawbacks, especially the cumbersome configuration need to be done just to create a bean.
- Applications built using Spring are very easy to test. For certain unit testing scenarios, the Spring Framework provides mock objects and testing support classes. Spring also provides unique “integration testing” functionality in the form of the Spring TestContext Framework and legacy JUnit 3.8 support classes that enable you to test your code quickly and easily, even while accessing a staging database.
- Spring is essentially a technology dedicated to enabling you to build applications using Plain Old Java Objects.
- Spring provides integration and support for many other technologies like Jsp, Struts, EJB, Hibernate etc.
- Spring helps in writing less redundant code and also separates the configuration code in a xml file.
The basic overview of Spring framework is:
The Core package is the most fundamental part of the framework and provides the IoC and Dependency Injection features. The main functionality of the container is to create and mangae beans. The Context package build on the solid base provided by the Core package: it provides a way to access objects in a framework-style manner in a fashion somewhat reminiscent of a JNDI-registry. The context package inherits its features from the beans package and adds support for internationalization (I18N) (using for example resource bundles), event-propagation, resource-loading, and the transparent creation of contexts by, for example, a servlet container.
The DAO package provides a JDBC-abstraction layer that removes the need to do tedious JDBC coding and parsing of database-vendor specific error codes. Also, the JDBC package provides a way to do programmatic as well as declarative transaction management, not only for classes implementing special interfaces, but for all your POJOs (plain old Java objects).
The ORM package provides integration layers for popular object-relational mapping APIs, including JPA, JDO, Hibernate, and iBatis. Using the ORM package one can use all those O/R-mappers in combination with all the other features Spring offers, such as the simple declarative transaction management feature mentioned previously.
Spring’s AOP package provides an AOP Alliance-compliant aspect-oriented programming implementation allowing you to define, for example, method-interceptors and pointcuts to cleanly decouple code implementing functionality that should logically speaking be separated.
Spring’s Web package provides basic web-oriented integration features, such as multipart file-upload functionality, the initialization of the IoC container using servlet listeners and a web-oriented application context. When using Spring together with WebWork or Struts, this is the package to integrate with.
Spring’s MVC package provides a Model-View-Controller (MVC) implementation for web-applications. Spring’s MVC framework is not just any old implementation; it provides a clean separation between domain model code and web forms, and allows you to use all the other features of the Spring Framework.
The main features which Spring has come up with:
1) Inversion Of Control (IOC)
2) Dependency Injection (DI)
3) Aspect Oriented Programming (AOP)
6) MVC layer for J2EE Application
7) Web flow
Each feature above me will be explaining one by one.
In the next article I will explain IOC.