-
Feb 2nd, 2010, 01:33 PM
#1
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
-
Feb 2nd, 2010, 01:55 PM
#2
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
-
Forum Rules