Results 1 to 3 of 3

Thread: ClassPathXmlApplicationContextJobFactory?

  1. #1
    Join Date
    Oct 2008
    Posts
    107

    Default ClassPathXmlApplicationContextJobFactory?

    The documentation refers us to the ClassPathXmlApplicationContextJobFactory as a reference for creating custom job factories. I could not seem to find this class in the sample project however. I looked at the online JavaDocs API for it and it does not seem to be listed there either.

    4.1.3. JobFactory and Stateful Components in Steps

    ...

    The strategy provided by Spring Batch to deal with this scenario is the JobFactory, and the samples provide an example of a specialized implementation that can load an ApplicationContext and close it properly when the job is finished. A relevant examples is ClassPathXmlApplicationContextJobFactory and its use in the adhoc-job-launcher-context.xml and the quartz-job-launcher-context.xml, which can be found in the Samples project.
    I would like to configure the steps required for a job dynamically based on user input. It seems the me the job factory is the proper way to do so. Is that correct? Is a reference factory available?

    Thanks.

    Keith

  2. #2
    Join Date
    Oct 2008
    Posts
    107

    Default Perhaps...

    Perhaps its more favorable just to let unnecessary steps fail but still return a job success if they weren't required... looks like that would be the way to fit this into the framework as step/job definitions are configured via XML.

    Keith

  3. #3
    Join Date
    Oct 2008
    Posts
    107

    Default Or...

    I can set the stepStatus to completed in a stepExecutionListener.beforeStep() if the step is not required...

    That'll work!

    Keith

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •