-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
lost transactionAttribute when using chaining StepBuilder.
- according to below code, there will be lost "transactionAttribute" already set.
DefaultTransactionAttribute readOnlyTxAttribute = new DefaultTransactionAttribute();
readOnlyTxAttribute.setReadOnly(true);
stepBuilderFactory.get("stepName")
.transactionManager(txManager)
.<InputType, OutputType>chunk(CHUNK_SIZE)
.reader(reader)
.writer(writer)
.transactionAttribute(readOnlyTxAttribute)
.faultTolerant()
.backOffPolicy(backOffPolicy())
.retryLimit(3)
.retry(SomeException.class)
.build();
- next below code, does not lost transactionAttribute. (just only difference is "where is transactionAttribute method call")
DefaultTransactionAttribute readOnlyTxAttribute = new DefaultTransactionAttribute();
readOnlyTxAttribute.setReadOnly(true);
stepBuilderFactory.get("stepName")
.transactionManager(txManager)
.<InputType, OutputType>chunk(CHUNK_SIZE)
.reader(reader)
.writer(writer)
.faultTolerant()
.backOffPolicy(backOffPolicy())
.retryLimit(3)
.retry(SomeException.class)
.transactionAttribute(readOnlyTxAttribute)
.build();
it seems to broken compatibility between SimpleStepBuilder and FaultTolerantStepBuilder (and both classes extends AbstractTaskletStepBuilder what have transactionAttribute property.)
there transactionAttributes will be missing on method calls. (there methods does not support copying "transactionAttribute")
- org.springframework.batch.core.step.builder.SimpleStepBuilder.faultTolerant
- org.springframework.batch.core.step.builder.FaultTolerantStepBuilder constructor
- org.springframework.batch.core.step.builder.SimpleStepBuilder constructor
- org.springframework.batch.core.step.builder.AbstractTaskletStepBuilder constructor
- org.springframework.batch.core.step.builder.StepBuilderHelper constructor