An Oddjob Property in Spring

Here’s my previous password passed to Spring example run from Oddjob:

Password PromptRun as a GUI, Oddjob provides a simple form for entering properties including a password prompt.

Here’s the Oddjob configuration:

            <input-password prompt="Password" property="jdbc.password" />
        <spring:job beanName="myQuery" xmlns:spring="oddjob:spring">
                <value value="rob/MyQuery.xml" />

The Spring configuration remains unchanged from my previous post, but I include it again here for your convenience:

<beans xmlns=""
  xmlns:xsi="" xmlns:context=""

  <context:property-placeholder location="" />

  <bean id="myQuery" class="rob.MyQuery">
    <property name="dataSource" ref="dataSource" />

  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    <property name="driverClassName" value="${jdbc.driverClassName}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />


The password prompt sets the property jdbc.password within Oddjob and my new SpringJob automatically makes every property defined in Oddjob available in Spring.

SpringJob can be given the name of any Runnable defined within Spring and it will run it. Any exceptions will be reflected in the state of SpringJob, and this can be used to trigger another job such as an email, or it can be used in a retry timer.

Here it is having run successfully.

Spring Job CompletedThe Oddjob configuration can be run directly from the console. The password prompt now changes to use the console:

Spring Job Console View

And that’s a very quick look at an Oddjob property in Spring.

The Oddjob Spring jobs can be found on Sourceforge here. They require Oddjob 1.2 to run, it is still in development but a reasonably stable snapshot can be found here.