Announcement Announcement Module
No announcement yet.
Quartz and DAO injection problem wtih SchedulerFactoryBean schedulerContextAsMap Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz and DAO injection problem wtih SchedulerFactoryBean schedulerContextAsMap

    As part of my Spring Batch process, I have created a class that watches for new files to arrive, stores their names in a database (if they're not already there), and passes that file name in the JobParameters to a job.

    I want to use Quartz to schedule looking for new files, and am having a problem with the schedulerContextAsMap in the SchedulerFactoryBean.

    If I use the map to inject a string, all is well; my problems start when I also use it to inject a DAO. Here is the ScheduleFactoryBean config:

    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
      <property name="jobFactory" ref="jobFactory" />
      <property name="schedulerContextAsMap">
          <entry key="message" value-ref="message" />
          <entry key="trackingDao" value-ref="cdrTrackingDao" />
      <property name="jobDetails">
          <ref bean="myJobDetail" />
      <property name="triggers">
          <ref bean="simpleTrigger" />
    Both properties get injected, but when a method is called on the dao in the execute() method, nothing (apparently) happens and the job quits.

    Is there anything I need to do with the DAO bean itself to make it more "valid"?


  • #2

    If I create an application that loads my app context, everything runs fine. If I load it in a JUnit, I have the problem I described. Wonder what the reason for that is...