Results 1 to 2 of 2

Thread: Fresh Application Context for each job Execution

  1. #1

    Default Fresh Application Context for each job Execution

    Hello,
    Going through a section on Job Configuration in spring batch (http://static.springsource.org/sprin...ponentsInSteps)

    I saw that it recommends creating a new Application Context for each job Execution.

    4.1.4. JobFactory and Stateful Components in Steps

    Unlike many traditional Spring applications, many of the components of a batch application are stateful; the file readers and writers are obvious examples. The recommended way to deal with this is to create a fresh ApplicationContext for each job execution.


    I think i'm missing the idea behind this. Why would you need to refresh the context at each job start and close it at job end?

    If its about closing Streams/destroying resources etc.- doesn't the ItemStream interface callback's close() etc. provide that already?


    Could someone enlighten...


    Thanks,
    -Amit

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    Ignore that (it's a remnant from 1.1.x). Just use scope="step" in your stateful components. I thought the user guide had been updated but that must have been in a different chapter.

Posting Permissions

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