You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the deprecation of JobBuilderFactory and StepBuilderFactory in #4188, JobBuilder and StepBuilder are now the main entry points to create jobs and steps. However, unlike when created by those factories, these builders do not have the mandatory job repository property set on them. This requires the user to set it manually with a chained call to .repository(jobRepository). This is error prone and can lead to runtime errors if this property is not set. The suggested enhancement is to make the API guide the user to set this property by accepting the job repository as a parameter when creating the builder, something like:
@Bean
public Job job(JobRepository jobRepository, Step step) {
-- return new JobBuilder("job").repository(jobRepository)++ return new JobBuilder("job", jobRepository)
.start(step)
.build();
}
Similarly, after #4130, the transaction manager is not set on tasklet step builders by the factory anymore. Therefore, the API should guide the user to correctly create tasklet steps with the transaction manager set on them instead of relying on an error prone chained call to .transactionManager().
The text was updated successfully, but these errors were encountered:
This commit deprecates JobBuilderFactory and StepBuilderFactory
in favor of the respective builders they create.
It also removes the exposure of such utilities as beans in the
application context when using `@EnableBatchProcessing`.
Resolves#4188
After the deprecation of
JobBuilderFactory
andStepBuilderFactory
in #4188,JobBuilder
andStepBuilder
are now the main entry points to create jobs and steps. However, unlike when created by those factories, these builders do not have the mandatory job repository property set on them. This requires the user to set it manually with a chained call to.repository(jobRepository)
. This is error prone and can lead to runtime errors if this property is not set. The suggested enhancement is to make the API guide the user to set this property by accepting the job repository as a parameter when creating the builder, something like:Similarly, after #4130, the transaction manager is not set on tasklet step builders by the factory anymore. Therefore, the API should guide the user to correctly create tasklet steps with the transaction manager set on them instead of relying on an error prone chained call to
.transactionManager()
.The text was updated successfully, but these errors were encountered: