Spring-Batch: how do I return a custom Job exit code from a StepListener

前端 未结 1 1843
深忆病人
深忆病人 2021-01-01 06:43

The issue is this: I have a Spring Batch job with a single step. This step is called multiple times. If every time it\'s called everything works ok (no Exceptions) the Job s

相关标签:
1条回答
  • 2021-01-01 07:36

    looks like you just can't alter the BatchStatus, but you can try it with the exitstatus

    this code with a JobListener works for me

    // JobListener with interface or annotation
    public void afterJob(JobExecution jobExecution) {
        jobExecution.setExitStatus(new ExitStatus("foo", "fooBar"));
    }
    
    0 讨论(0)
提交回复
热议问题