OPEN - issue BATCH-791: Ditch Tasklet (StepHandler is more flexible)
Done. Use StepHandler instead.
This commit is contained in:
@@ -15,19 +15,22 @@
|
||||
*/
|
||||
package org.springframework.batch.integration.job;
|
||||
|
||||
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.step.handler.StepHandler;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.core.AttributeAccessor;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TestTasklet implements Tasklet {
|
||||
public class TestStepHandler implements StepHandler {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.step.tasklet.Tasklet#execute()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*/
|
||||
public ExitStatus execute() throws Exception {
|
||||
public ExitStatus handle(StepContribution contribution, AttributeAccessor attributes) throws Exception {
|
||||
return ExitStatus.FINISHED;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,10 @@
|
||||
<property name="steps" ref="step" />
|
||||
</bean>
|
||||
|
||||
<bean id="step" class="org.springframework.batch.core.step.tasklet.TaskletStep">
|
||||
<property name="tasklet">
|
||||
<bean class="org.springframework.batch.integration.job.TestTasklet" />
|
||||
<bean id="step" parent="handlerStep">
|
||||
<property name="stepHandler">
|
||||
<bean class="org.springframework.batch.integration.job.TestStepHandler" />
|
||||
</property>
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -26,9 +26,10 @@
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="restartable" value="true" />
|
||||
</bean>
|
||||
<bean id="taskletStep"
|
||||
class="org.springframework.batch.core.step.tasklet.TaskletStep"
|
||||
<bean id="handlerStep"
|
||||
class="org.springframework.batch.core.step.handler.StepHandlerStep"
|
||||
abstract="true">
|
||||
<property name="transactionManager" ref="transactionManager" />
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="allowStartIfComplete" value="true" />
|
||||
</bean>
|
||||
|
||||
Reference in New Issue
Block a user