Announcement Announcement Module
No announcement yet.
How can the JobParameters be available for steps? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can the JobParameters be available for steps?


    I add some parameters in a JobParameters object when I launch my Jobs with JobRepositoryFactoryBean and leJobLauncher.

    The job is a org.springframework.batch.core.job.SimpleJob with a single step.

    The step is a org.springframework.batch.core.step.item.SkipLimit StepFactoryBean
    which has a org.springframework.batch.item.database.DrivingQue ryItemReader which contains a custom KeyCollector.

    This keycollector needs to access the jobParameters in order to obtain some input data to be able to fetch they keys - hos can this be done as the execution context is missing these parameters (the jobparameters)?

  • #2
    In 1.1.x, make your collector a StepExecutionListener, register it with the step, and call stepExecution.getJobParameters().

    In 2.0, simply wire in the property with #{jobParameter[]}