Announcement Announcement Module
Collapse
No announcement yet.
Quartz and DAO injection problem wtih SchedulerFactoryBean schedulerContextAsMap Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:

    Code:
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
      <property name="jobFactory" ref="jobFactory" />
      <property name="schedulerContextAsMap">
        <map>
          <entry key="message" value-ref="message" />
          <entry key="trackingDao" value-ref="cdrTrackingDao" />
        </map>
      </property>
      <property name="jobDetails">
        <list>
          <ref bean="myJobDetail" />
        </list>
      </property>
      <property name="triggers">
        <list>
          <ref bean="simpleTrigger" />
        </list>
      </property>
    </bean>
    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"?

    Brian

  • #2
    Interesting...

    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...

    Brian

    Comment

    Working...
    X