什么是Spring Batch的“默认"商品?上下文变量? [英] What are the Spring Batch "default" Context Variables?

查看:161
本文介绍了什么是Spring Batch的“默认"商品?上下文变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring Batch step中-scope 文档,其中有三个无法解释的spring-batch上下文映射:jobParametersjobExecutionContextstepExecutionContext.

Springsource示例代码,组合:

Springsource sample code, combined:

<bean id="flatFileItemReader" scope="step"
  class="org.springframework.batch.item.file.FlatFileItemReader">
    <property name="var1" value="#{jobParameters['input.file.name']}" />
    <property name="var2" value="#{jobExecutionContext['input.file.name']}" />
    <property name="var3" value="#{stepExecutionContext['input.file.name']}" />
</bean>

jobParametersjobExecutionContextstepExecutionContext中可用的默认参数是什么?

What are the default parameters available within jobParameters, jobExecutionContext, and stepExecutionContext?

Spring Batch版本1.x与2.x与3.x之间也可能存在差异-该领域的文档非常稀缺.

There are also likely differences between what's available in Spring Batch version 1.x vs. 2.x vs. 3.x--the documentation is pretty scarce in this area.

推荐答案

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

#{jobParameters}, #{jobExecutionContext} and #{stepExecutionContext} are the spEL (Spring Expression Language) counterpart of JobParameters, JobExecution and StepExecution objects available in late-binding to allow non-static access to this objects values from step scoped object.

它们支持Map的访问,因此您可以访问JobExecutionStepExecution关联的ExecutionContext 以及存储在JobParameters中的值.

They support access as Maps so you can access the ExecutionContext associated to JobExecution and StepExecution and values stored in JobParameters.

还要检查 StepScope 文档以获取更多信息.

Also check StepScope documentation for more information.

这篇关于什么是Spring Batch的“默认"商品?上下文变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆