@@ -48,7 +48,7 @@ public Job footballJob(JobRepository jobRepository) {
4848
4949[role="javaContent"]
5050A `Job` (and, typically, any `Step` within it) requires a `JobRepository`. The
51- configuration of the `JobRepository` is handled through the <<job.adoc#javaConfig,`BatchConfigurer `>>.
51+ configuration of the `JobRepository` is handled through the <<job.adoc#javaConfig,`Java Configuration `>>.
5252
5353[role="javaContent"]
5454The preceding example illustrates a `Job` that consists of three `Step` instances. The job related
@@ -444,13 +444,14 @@ annotation and two builders.
444444
445445The `@EnableBatchProcessing` annotation works similarly to the other `@Enable*` annotations in the
446446Spring family. In this case, `@EnableBatchProcessing` provides a base configuration for
447- building batch jobs. Within this base configuration, an instance of `StepScope` and `Jobscope ` are
447+ building batch jobs. Within this base configuration, an instance of `StepScope` and `JobScope ` are
448448created, in addition to a number of beans being made available to be autowired:
449449
450450* `JobRepository`: a bean named `jobRepository`
451451* `JobLauncher`: a bean named `jobLauncher`
452452* `JobRegistry`: a bean named `jobRegistry`
453453* `JobExplorer`: a bean named `jobExplorer`
454+ * `JobOperator`: a bean named `jobOperator`
454455
455456The default implementation provides the beans mentioned in the preceding list and requires a `DataSource`
456457and a `PlatformTransactionManager` to be provided as beans within the context. The data source and transaction
@@ -1313,9 +1314,9 @@ The following example shows how to configure a `JobExplorer` in Java:
13131314[source, java, role="javaContent"]
13141315----
13151316...
1316- // This would reside in your BatchConfigurer implementation
1317- @Override
1318- public JobExplorer getJobExplorer () throws Exception {
1317+ // This would reside in your DefaultBatchConfiguration extension
1318+ @Bean
1319+ public JobExplorer jobExplorer () throws Exception {
13191320 JobExplorerFactoryBean factoryBean = new JobExplorerFactoryBean();
13201321 factoryBean.setDataSource(this.dataSource);
13211322 return factoryBean.getObject();
@@ -1348,9 +1349,9 @@ The following example shows how to set the table prefix for a `JobExplorer` in J
13481349[source, java, role="javaContent"]
13491350----
13501351...
1351- // This would reside in your BatchConfigurer implementation
1352- @Override
1353- public JobExplorer getJobExplorer () throws Exception {
1352+ // This would reside in your DefaultBatchConfiguration extension
1353+ @Bean
1354+ public JobExplorer jobExplorer () throws Exception {
13541355 JobExplorerFactoryBean factoryBean = new JobExplorerFactoryBean();
13551356 factoryBean.setDataSource(this.dataSource);
13561357 factoryBean.setTablePrefix("SYSTEM.");
@@ -1389,7 +1390,7 @@ The following example shows how to configure your own `JobRegistry`:
13891390----
13901391...
13911392// This is already provided via the @EnableBatchProcessing but can be customized via
1392- // overriding the getter in the SimpleBatchConfiguration
1393+ // overriding the bean in the DefaultBatchConfiguration
13931394@Override
13941395@Bean
13951396public JobRegistry jobRegistry() throws Exception {
@@ -1430,9 +1431,9 @@ defined in Java:
14301431[source, java, role="javaContent"]
14311432----
14321433@Bean
1433- public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor() {
1434+ public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor(JobRegistry jobRegistry ) {
14341435 JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor();
1435- postProcessor.setJobRegistry(jobRegistry() );
1436+ postProcessor.setJobRegistry(jobRegistry);
14361437 return postProcessor;
14371438}
14381439----
@@ -1615,7 +1616,6 @@ The following example shows a typical bean definition for `SimpleJobOperator` in
16151616 JobLauncher jobLauncher) {
16161617
16171618 SimpleJobOperator jobOperator = new SimpleJobOperator();
1618-
16191619 jobOperator.setJobExplorer(jobExplorer);
16201620 jobOperator.setJobRepository(jobRepository);
16211621 jobOperator.setJobRegistry(jobRegistry);
@@ -1626,6 +1626,9 @@ The following example shows a typical bean definition for `SimpleJobOperator` in
16261626----
16271627====
16281628
1629+ As of version 5.0, the `@EnableBatchProcessing` annotation automatically registers a job operator bean
1630+ in the application context.
1631+
16291632NOTE: If you set the table prefix on the job repository, do not forget to set it on the job explorer as well.
16301633
16311634[[JobParametersIncrementer]]
0 commit comments