Jul 2nd, 2008, 10:49 AM
Reusing ItemReaders and ItemWriters
I am trying to inject the same writer and reader into my step, only thing that changes is the file name (in case of writer) and sql (in case of reader).
When I have two steps, the file for the first step gets created without any problem, while the file in the second step is not getting created at all. Do we have any restriction on the reuse of writers? Do we prohibit this in writer?
Once this is resolved, I need to then check whether the second step correctly picks up the reader with the second SQL. I am using 1.0.1 and I am dynamically changing the file name and SQL in my beforeStep method of StepListener (by injecting the reader and writer into it).
Jul 3rd, 2008, 02:06 AM
I would say in general, you should expect readers and writers to be stateful and not re-use them. There might be a bug there, but the workaround is easy anyway - don't re-use the same instance. Parent bean definitions should work fine for re-using the configuration, but not the same instance.
Last edited by Dave Syer; Jul 3rd, 2008 at 02:07 AM.
Jul 3rd, 2008, 05:44 AM