Add AbstractTaskletStepBuilder copy constructor

This commit includes tests for the copy constructor
of AbstractTaskletStepBuilder and for the faultTolerant
method, specifically after taskExecutor has been set.
This commit is contained in:
Ilpyo-Yang
2023-10-23 23:32:12 +09:00
committed by Mahmoud Ben Hassine
parent 01cb0aefd2
commit b9ba8ffb86
3 changed files with 132 additions and 1 deletions

View File

@@ -49,6 +49,7 @@ import org.springframework.transaction.interceptor.TransactionAttribute;
* @author Dave Syer
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @author Ilpyo Yang
* @since 2.2
* @param <B> the type of builder represented
*/
@@ -74,6 +75,23 @@ public abstract class AbstractTaskletStepBuilder<B extends AbstractTaskletStepBu
super(parent);
}
/**
* Create a new builder initialized with any properties in the parent. The parent is
* copied, so it can be re-used.
* @param parent a parent helper containing common step properties
*/
public AbstractTaskletStepBuilder(AbstractTaskletStepBuilder<?> parent) {
super(parent);
this.chunkListeners = parent.chunkListeners;
this.stepOperations = parent.stepOperations;
this.transactionManager = parent.transactionManager;
this.transactionAttribute = parent.transactionAttribute;
this.streams.addAll(parent.streams);
this.exceptionHandler = parent.exceptionHandler;
this.throttleLimit = parent.throttleLimit;
this.taskExecutor = parent.taskExecutor;
}
protected abstract Tasklet createTasklet();
/**

View File

@@ -114,7 +114,6 @@ public class SimpleStepBuilder<I, O> extends AbstractTaskletStepBuilder<SimpleSt
this.itemListeners = parent.itemListeners;
this.readerTransactionalQueue = parent.readerTransactionalQueue;
this.meterRegistry = parent.meterRegistry;
this.transactionManager(parent.getTransactionManager());
}
public FaultTolerantStepBuilder<I, O> faultTolerant() {