From 020d0519ace886df3a5a97c16bf3b62b3e8ad67a Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Mon, 8 Jan 2018 14:55:58 +0100 Subject: [PATCH] BATCH-2669: Fix code examples in "Configuring and Running a Job" section of the documentation --- spring-batch-docs/asciidoc/job.adoc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/spring-batch-docs/asciidoc/job.adoc b/spring-batch-docs/asciidoc/job.adoc index 578b1edce..f4df51983 100644 --- a/spring-batch-docs/asciidoc/job.adoc +++ b/spring-batch-docs/asciidoc/job.adoc @@ -1302,11 +1302,11 @@ As is evident from the method signatures above, ... // This would reside in your BatchConfigurer implementation @Override -public JobExplorer getJobExplorer() { +public JobExplorer getJobExplorer() throws Exception { JobExplorerFactoryBean factoryBean = new JobExplorerFactoryBean(); factoryBean.setDataSource(this.dataSource); - return factoryBean; -}} + return factoryBean.getObject(); +} ... ---- @@ -1329,11 +1329,11 @@ public JobExplorer getJobExplorer() { ... // This would reside in your BatchConfigurer implementation @Override -public JobExplorer getJobExplorer() { +public JobExplorer getJobExplorer() throws Exception { JobExplorerFactoryBean factoryBean = new JobExplorerFactoryBean(); factoryBean.setDataSource(this.dataSource); factoryBean.setTablePrefix("SYSTEM."); - return factoryBean; + return factoryBean.getObject(); } ... ---- @@ -1353,7 +1353,7 @@ A `JobRegistry` (and its parent interface `JobLocator`) is not [source, xml, role="xmlContent"] ---- - + ---- [role="javaContent"] @@ -1368,7 +1368,7 @@ If you want to configure your own: @Override @Bean public JobRegistry jobRegistry() throws Exception { - return new new MapJobRegistry(); + return new MapJobRegistry(); } ... ---- @@ -1450,7 +1450,12 @@ This is a lifecycle component that creates child contexts and public AutomaticJobRegistrar registrar() { AutomaticJobRegistrar registrar = new AutomaticJobRegistrar(); + registrar.setJobLoader(jobLoader()); + registrar.setApplicationContextFactories(applicationContextFactories()); + registrar.afterPropertiesSet(); + return registrar; +} ---- The registrar has two mandatory properties, one is an array of