Spring Batch FlatFileItemWriter - How to use stepExecution.jobId to generate file name

夙愿已清 提交于 2019-11-29 02:22:22
Luca Basso Ricci

The supported names for late-bindig are:

  • #{jobParameters}
  • #{jobExecutionContext}
  • #{stepExecutionContext}

If jobId is not directly accessible, look this question.

Also, resource can be injected directly as

<property name="resource">
  <value>file://${csv.file}_#{jobExecutionContext['jobId']}</value>
</property>

because the right resource type is created using a converter.

#{stepExecution.jobExecution.id} or #{stepExecution.jobExecutionId} should work though.

The StepContext does provide access to the StepExecution for late binding via SpEL expressions.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!