Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken code samples in reference documentation for Job/Step beans with v5 API #4406

Closed
andygoossens opened this issue Jun 29, 2023 · 1 comment

Comments

@andygoossens
Copy link

Commit 219fee3 modified some code examples for the API introduced in v5. Some of those examples won't compile now.

See sections:

Example:

@Bean
public Job sampleJob(JobRepository jobRepository) {
    return new JobBuilder("sampleJob", jobRepository)
                     .start(step1())
                     .build();
}

@Bean
public Step step1(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
	return new StepBuilder("step1", jobRepository)
				.<String, String>chunk(10, transactionManager)
				.reader(itemReader())
				.writer(itemWriter())
				.build();
}

In the sampleJob bean, there is a method call to step1(). But as you see, it does not provide JobRepository and PlatformTransactionManager parameters.

To fix it, those parameters should be provided, or perhaps the sampleJob method should autowire the step1 bean instead.

@andygoossens andygoossens added status: waiting-for-triage Issues that we did not analyse yet type: bug labels Jun 29, 2023
@fmbenhassine fmbenhassine added in: documentation and removed status: waiting-for-triage Issues that we did not analyse yet labels Jul 10, 2023
@fmbenhassine
Copy link
Contributor

Good catch! I have previously created #4205 to avoid this kind of issues. Thank you for reporting it anyway.

@fmbenhassine fmbenhassine added this to the 5.1.0 milestone Nov 17, 2023
@fmbenhassine fmbenhassine added the for: backport-to-5.0.x Issues that will be back-ported to the 5.0.x line label Nov 17, 2023
@fmbenhassine fmbenhassine removed the for: backport-to-5.0.x Issues that will be back-ported to the 5.0.x line label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants