I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Wednesday 12 December 2007

Spring framework

The following explanation comes mainly from an article from: the ServerSide

Since Spring is a framework which is gathering speed and value in the software industry, I also had to take a look at this framework.

The spring framework is based on the use of a method close to the design pattern: dependency injection (a flavor of another pattern called inversion of control). The basic idea is that there is a light-weight container which helps the programmer managing the life cycle of the objects ( from creation to destruction). It is similar to the idea of bean container, but also work with POJOs (Plain Old Data Objects). This has two advantages:

  • it is a lightweight container which can be used on top of application servers like Web Sphere, JBoss,...
  • the configuration of the object can be done easily through configuration files (some can be in XML, but simple property files are also possible)
Supplementary to the Inversion of control features, the spring framework provides a number of supplementary help tools. For example: using the JDBCTemplate class on a data source, it is easy to query and store the results of the query in a list.

JDBC, Hibernate and Transactions

There is many possibilities to use JDBC with DAO object with the spring framework. It allows the possibility to use configuration to use JTA transaction or direct call using direct JDBC calls or calls to Hibernate.

Aspect Orientation

Using the Spring AOP features you can specify:

  • Interception: some code can be called before or after method calls for any interface or class.
  • Introduction: it is possible to use advices to modify the class or implementation of classes and objects ( the called code when getting to a point cut, i.e when a crosscutting feature must be implemented
  • Static and dynamic pointcuts: the static pointcuts define what happens when a join point is reached; it is possible to consider parameters of method for the pointcut definition. Through separation from pointcuts and interceptors, the interceptors can be reused in different applications.
Moreover, Spring integrates with AspectJ, so it is possible to use aspectJ code with Spring.

Again using the AOP from spring, it is possible to implement transaction management with Rollback with or without JTA.

MVC

Spring contains a powerful and highly configurable MVC framework which integrates well with struts, JSP, velocity...

EJB

Spring framework can be useful for implementing EJBs as well as on the client side of the EJBs

Testing

Testing is very important for enterprise applications, Spring allows many aspects of testings in particular unit testing through the use of the inversion of control design pattern.

This is very succint especially toward the end but I will complete it later.