Thursday, May 28, 2009

Injecting beans into Quartz job

Finally as promised the revised and more efficient way to inject beans directly into your quartz jobs. Simply use the jobDataAsMap property.
<bean name="jobBean" class="org.springframework.scheduling.quartz.JobDetailBean">
  <property name="jobClass" value="com.irahul.example.SpringQuartzJob" />   
    <property name="name" value="jobName" />
    <property name="jobDataAsMap">
   <map>
    <entry key="setterName" value-ref="beanRef" />    
                                .....
   </map>
  </property>
 </bean>

No comments: