a journal of a researcher

Wednesday, July 09, 2008

A first insight on Spring Framework

What is Spring? Spring is a framework for enterprise application development. It uses only the so-called plain-old java objects (POJO) to implement enterprise functions, such as database connection, resources balancing, front end, messaging, remote access. It also uses container (like EJB) to provide services to javabeans. Compared to EJB, Spring uses DI and AOP. So Spring is more loose coupling, and function separation.

For me, DI is nothing, but a design pattern. 1) use interface (object decoupling) for the attributes (objects) of a bean. Then the object does not need to know where the attribute is. Or in another word, the object does not need to know if the attribute objects are local or a remote Web service. 2) initialize the attribute object when the bean is initialized – inject the object, instead of asking the bean to search/call the object. 3) the attributes of an object can be initialized by XML description, that means the container takes care of initialization.

AOP: use DI first, that means you initialize the attribute objects. You embed one object inside a bean. The bean does not need to know the detail of the object.