Skip to content

Incorrect handling of job parameters when using a JobParametersIncrementer #4910

Closed

Description

@fmbenhassine

The JobParametersIncrementer concept is a useful abstraction to use when there is a natural sequence of job instances (hourly, daily, etc). The goal of this abstraction is to bootstrap the initial set of job parameters and let the framework calculate the parameters of the next instance in the sequence. This was clear since the initial design of the JobOperator#startNextInstance(String jobName) method (notice the lack of job parameters in the signature). The concept is similar to database sequences that are initialized once by the user and incremented automatically by the database system (ie not altered by the user anymore).Therefore, it does not make sense to provide job parameters when using an incrementer.

Unfortunately, this feature has been incorrectly used through the command line runners of Spring Batch and Spring Boot for many years and I have seen users messing with job parameters between sequences, which goes against the initial intent of the incrementer concept, and which in turn caused several confusing issues like #882, spring-projects/spring-boot#22602 and spring-projects/spring-boot#14484. If someone starts to modify the sequence's logic and altering job parameters in between instances, (s)he should not use an incrementer in the first place.

v6 is a good opportunity to fix that. When a job parameters incrementer is attached to a job definition, the parameters of the next instance should be calculated by the framework, and any additional parameters supplied by the user should be ignored with a warning.

Activity

  1. self-assigned this
    on Jul 16, 2025
  2. added
    status: for-internal-team
    on Jul 16, 2025
  3. added this to the 6.0.0 milestone on Jul 16, 2025
  4. added a commit that references this issue on Jul 16, 2025
    eb42128
  5. modified the milestones: 6.0.0, 6.0.0-M1 on Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: corestatus: for-internal-teamtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions