« "The Village" | Main | Translating Document Representations Using Betwixt & XSLT »

Developing with the Spring Framework

I've been experimenting with the Spring Framework lately while developing a strictly-for-fun web application. I have been really frustrated with the invasiveness of the Struts Framework in past years. Fortunately, Spring has none of these flaws. It works on two core principles: Dependency Injection, and Aspect-Oriented Programming (AOP).

Dependency Injection has radically changed how I approach Object-Oriented Programming (OOP). It relies on classes defining what they want, and allowing the Spring Framework to give it to them. This is different from standard Java programming in that traditionally classes would concern themselves with both constructing and using their dependencies. With Spring, classes are concerned only with using their dependencies. Hence, their dependencies are "injected".

Spring handles Dependency Injection (DI) through XML descriptors that are loaded by the Spring Container at runtime. This provides a great way to alter the behavior of application processing classes simply by changing how their dependencies are built and assigned through the descriptor files. A key component of DI is the use of interfaces to describe the operations & data available to users of a component. If consumers of the component use DI and program to the component interface, the component implementation is open to change and substitution with little or no modification to the consumers.

I'm currently reading the "Spring in Action" book from Manning Press. It's a well-written overview of the Spring Framework, and is a great companion to the wonderful documentation included with the Spring distribution.

walls2_cover150.jpg