Announcement Announcement Module
No announcement yet.
dynamic reader Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic reader

    Greetings all

    How can I define a dynamic readers in my context application

    I tried to do some thing like :
    <chunk reader="#{jobParameters[reader]}" processor="processor" writer="compositewriter">

    but it did not work,

    Any help will be much appreciated


  • #2
    The chunk provider has to be created before the step is started, so there is no way to bind the reader itself as late as that. You would have to write a wrapper that can be injected as the reader, but lazily initialize to resolve the late bound parameter value when it is used. It's pretty easy to do that - I think it would work just to create an delegating ItemReader wrapper in step scope and initialize it with the same expression you are using in your example.


    • #3
      Hi Dave

      Thank you for the reply
      I really did not understand well how to implement your idea

      But I did some think that fixed my problem (It is little bit far from what I was seeking)

      I made I reader switcher like :
      <chunk reader="switchReader" processor="myProcessor" writer="myWriter" >

      and then I implemented my own class in which I switch from reader to reader :
      <bean id="switchReader" class="...ItemReaderSwitcher">

      and It worked

      Is that what you wanted me to do ?

      thanks in advance