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

  • How can the JobParameters be available for steps?

    Hi!

    I add some parameters in a JobParameters object when I launch my Jobs with org.springframework.batch.core.repository.support. JobRepositoryFactoryBean and org.springframework.batch.core.launch.support.Simp 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[parameter.name]}

    Comment

    Working...
    X