Skip to content

Introduce @JobParameter for convenient access to JobParameters - #5564

Closed
quaff wants to merge 1 commit into
spring-projects:mainfrom
quaff:patch-77
Closed

quaff wants to merge 1 commit into
spring-projects:mainfrom
quaff:patch-77

Conversation

@quaff

@quaff quaff commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Closes GH-5563

* </p>
*
* @author Yanming Zhou
* @since 6.1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure which version is targeted.

@zhujianxintian

Copy link
Copy Markdown

I took a rough look at it, the code is fine.

@fmbenhassine fmbenhassine added the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Oct 1, 2026
@fmbenhassine

Copy link
Copy Markdown
Contributor

Thank you for the PR! That's great!

I added a couple inline comments, please take a look and let me know what you think.

Closes spring-projectsGH-5563

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
@quaff

quaff commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@fmbenhassine Updated, please review.

@fmbenhassine

Copy link
Copy Markdown
Contributor

That's great! Thank you for the updates. LGTM now 👍

I will follow up with a refinement commit to update docs and add a couple tests.

@fmbenhassine fmbenhassine removed the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Oct 12, 2026
fmbenhassine added a commit that referenced this pull request Oct 12, 2026
- Name the offending method and parameter in the exception thrown when
  the implicit name is not available (code compiled without -parameters).
- Document in the javadoc of @JobParameter that a missing job parameter
  is injected as null, that the annotation needs a job or step scoped
  bean, and that implicit names of method parameters require -parameters.
- Fix the example of the @JobParameter javadoc and the javadoc of the
  resolver, which was copied from the qualifier resolver.
- Make the constructor of the resolver package-private, like its class.
- Use 2026 as start year of the copyright of the new files.
- Show the import of @JobParameter in the reference documentation, and
  explain that it is not the JobParameter class.
- Add tests for job scoped beans, a missing job parameter, an unavailable
  implicit name, and the preservation of the resolver when the bean factory
  configuration is copied.
- Add a section about @JobParameter to the what's new page.

Related to #5563
@fmbenhassine

Copy link
Copy Markdown
Contributor

Rebased and merged as a7d6678, refined in ce019ef.

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a @JobParameter annotation for more convenient access to variables in JobParameters.

3 participants