Java Reference
In-Depth Information
interval. You then create two steps that inherit from vehicleStep : carStep and truckStep . Each uses the
same reader and writer that has been configured in vehicleStep . In each case, they add an item
processor that does different things. carStep has chosen to use the inherited commit-interval of 50
items, whereas truckStep has overridden the commit-interval and set it to 5 items.
Listing 4-32. Adding Attributes in Step Inheritance
<step id="vehicleStep">
<chunk reader="vehicleReader" writer="vehicleWriter" commit-interval="50"/>
<step id="carStep" parent="vehicleStep">
<chunk processor="carProcessor"/>
<step id="truckStep" parent="vehicleStep">
<chunk processor="truckProcessor" commit-interval="5"/>
<job id="exampleJob">
<step id="step1" parent="carStep" next="step2"/>
<step id="step2" parent="truckStep"/>
By declaring a step abstract, as in Java, you're allowed to leave things out that would otherwise be
required. In an abstract step, as in Listing 4-33, you're allowed to leave off the reader , writer , processor ,
and tasklet attributes. This would normally cause an initialization error when Spring tried to build the
step; but because it's declared abstract, Spring knows that those will be populated by the steps that
inherit it.
Listing 4-33. An Abstract Step and Its Implementations
<beans:bean id="inputFile"
class="" scope="step">
<beans:constructor-arg value="#{jobParameters[inputFile]}"/>
<beans:bean id="outputFile"
class="" scope="step">
<beans:constructor-arg value="#{jobParameters[outputFile]}"/>
<beans:bean id="inputReader"
<beans:property name="resource" ref="inputFile"/>
<beans:property name="lineMapper">
Search WWH ::

Custom Search