Tim Burns' Personal Weblog Flavored with Math, Java, and Oracle
 
Saturday, July 24, 2004 [*]
 

Diving into Spring

As part of my New Book, New Directions agenda, I just started diving into Spring. The first interesting discovery was the use of the configuration files to map beans to various persistence layers. Say if I wanted a user object for the session. I would declare a user interface IUser.java and then specify the mapping to a persistence layer using the configuration files.

In the configuration (soundbuilder-servlet.xml file for my main controller, I add a reference to the user bean.

    <bean id="soundBuilderController"
          class="com.owlmountain.soundbuilder.web.SoundBuilderController">
      <property name="methodNameResolver">
        <ref local="mainMethodNameResolver"/>
      </property>
      <property name="daoUser"><ref bean="daoUser"/></property>
       ...
    </bean>
    

In application context configuration file (applicationContext.xml, I define the persistence handler for the user interface. Say I want to use the nifty HSQL DB in-memory database that comes with Spring. I just write the persistence into a class called DaoUserHsql, and enter the mapping to the name "daoUser" in the file.

    
      <bean id="daoUser" 
          class="com.owlmountain.soundbuilder.dao.DaoUserHsql"/>
    
    

Pretty slick, now when I implement my business logic, I'm dealing with interfaces only.

 
Comments [0]
 
xml    Blogroll Me!

Personal

Waterfire Date

Being a Father Changes Everything

Daddy's in Charge

Rhode Island is Famous For You

Discovering My Own Backyard

Autumn lingers in New England

 

Java

Regular Expressions and Unit Tests
Tracking Errors with JavaMail
Really Simple Tomcat, Really
J2EE with Free Software
 

Numerical

The SVD, Benchmarking and Optimization
Fun with Optimization
 

Perl

New Computer and Perl CTime
 

Nature

The Morning Run

Coprinus Plicatilis

Morning of the Wolf

 

The Daily Chronic

 

Currently Reading

 

References

BioInformatics

BioTech

Epicurious

Statistics

 

Archive

2004
 August 07 11 15
 July 04 07 09 14 15 18 19 20 21 22 24 25 30
 June 02 05 09 17 21 24 28
 May 05 06 10 11 12 15 20 24 25 28 29
 April 01 04 07 09 11 16 17 18 20 22 24 25 27 29
 March 02 15 21 22 24 27
 February 13
 January 04 16 19 29
2003
 December 06 12
 November 02 23 29
 October 07 11 12 16 18 21 24 26
 September 04 09 10 12 14 28
 August 05 08 13 17 18 25 29
 July
 June
2002
2001
 

Photos

Morning of the Wolf
Phantom Farms
Providence
Baby Shower
Camden, Maine
 

Resume

 

Wiki

Creative Commons License
This work is licensed under a Creative Commons License