spring-projects / spring-projects/spring-batch

When I do not use transactions, if the Tasklet throws an exception, it continues to execute

Open
#4,891 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

has: minimal-example has: votes in: core type: bug
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

private TransactionAttribute getTransactionAttribute() {
        RuleBasedTransactionAttribute attribute = new RuleBasedTransactionAttribute();
        attribute.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
        return attribute;
    }

@Slf4j
@Component
public class XxxTasklet implements Tasklet {

    @Override
    public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {

        try {
            throw new Exception("test");
       
        } catch (Exception e) {
            log.error("test error");
            throw new Exception("test error");
        }

  
    }

}

This is my code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report identifies getTransactionAttribute() and XxxTasklet.execute(...); start by reproducing the non-transactional Tasklet with the shown exception and tracing whether execution continues afterward. Clarify the expected stop behavior and add a regression test for that scenario; done means the observed execution matches the agreed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.