Announcement Announcement Module
Collapse
No announcement yet.
Reusing ItemReaders and ItemWriters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Thanks!

  • #2
    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, 02:07 AM. Reason: spelling

    Comment


    • #3
      Thanks Dave!

      Comment

      Working...
      X