org.springframework.batch.core.jsr.job

## Class JsrStepHandler

- java.lang.Object
- - org.springframework.batch.core.job.SimpleStepHandler
  - - org.springframework.batch.core.jsr.job.JsrStepHandler

- All Implemented Interfaces:
    StepHandler, org.springframework.beans.factory.InitializingBean

      public class JsrStepHandler
      extends SimpleStepHandler

  Extends `SimpleStepHandler` to apply JSR-352 specific logic for whether to start a step.
  Since:
    3.0
  Author:
    Michael Minella

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsrStepHandler(JobRepository jobRepository, JobExplorer jobExplorer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()` Check mandatory properties (jobRepository).
    `protected boolean` | `shouldStart(StepExecution lastStepExecution, JobExecution jobExecution, Step step)` Given a step and configuration, return true if the step should start, false if it should not, and throw an exception if the job should finish.

    - ### Methods inherited from class org.springframework.batch.core.job.SimpleStepHandler

      `getJobRepository, handleStep, setExecutionContext, setJobRepository`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JsrStepHandler

          public JsrStepHandler(JobRepository jobRepository,
                                JobExplorer jobExplorer)

      Parameters:
        `jobRepository` -

  - ### Method Detail

    - #### afterPropertiesSet

          public void afterPropertiesSet()
                                  throws java.lang.Exception

      Description copied from class: `SimpleStepHandler`
      Check mandatory properties (jobRepository).
      Specified by:
        `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
      Overrides:
        `afterPropertiesSet` in class `SimpleStepHandler`
      Throws:
        `java.lang.Exception`
      See Also:
        `InitializingBean.afterPropertiesSet()`

    - #### shouldStart

          protected boolean shouldStart(StepExecution lastStepExecution,
                                        JobExecution jobExecution,
                                        Step step)
                                 throws JobRestartException,
                                        StartLimitExceededException

      Given a step and configuration, return true if the step should start, false if it should not, and throw an exception if the job should finish.
      Overrides:
        `shouldStart` in class `SimpleStepHandler`
      Parameters:
        `lastStepExecution` - the last step execution
        `jobExecution` -
        `step` -
      Throws:
        `StartLimitExceededException` - if the start limit has been exceeded for this step
        `JobRestartException` - if the job is in an inconsistent state from an earlier failure