Skip to content

lost transactionAttribute when using chaining StepBuilder #3686

@hoyeol

Description

@hoyeol

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions