https://grokonez.com/spring-framework/spring-batch/use-spring-batch-late-binding-step-scope-job-scope

How to use Spring Batch Late Binding – Step Scope & Job Scope

Spring Batch Late Binding provides a solution for late binding Job’s Parameters with Beans’ properties. In the tutorial, JavaSampleApproach will introduce Spring Batch Late Binding cleary by a sample project.

Related Articles:

  1. How to use Spring Batch Inheritance function
  2. How to use Intercepting Job Execution in Spring Batch
  3. How to start with Spring Batch using Spring Boot – Java Config
  4. Spring Batch Partition for Scaling & Parallel Processing

I. Spring Batch Late Binding

See below configuration:
<!-- Abstract Parent Bean -->
<beans:bean id="parentBean" abstract="true">
	<beans:property name="folder" value="${folder}"/>
	<beans:property name="fileName" value="${inputFileName}"/>
</beans:bean> 

The configuration uses a traditional approach:${folder} & ${inputFileName}
folder & inputFileName must define in a configuration file, like application.properties:


folder=C:\\readfile
inputFileName=1.txt

Question: How to bind data between Job Parameters & Beans’ properties?
Answer: Spring Batch Late Binding with Job & Step attributes.

1. Step Scope

Spring Batch provides various form for late binding with Step attributes:

https://grokonez.com/spring-framework/spring-batch/use-spring-batch-late-binding-step-scope-job-scope

How to use Spring Batch Late Binding – Step Scope & Job Scope

#springbatch #springboot #job

How to use Spring Batch Late Binding - Step Scope & Job Scope » grokonez
6.00 GEEK