diff --git a/spring-batch-execution/.springBeans b/spring-batch-execution/.springBeans
index d3af34221..2683003dd 100644
--- a/spring-batch-execution/.springBeans
+++ b/spring-batch-execution/.springBeans
@@ -15,27 +15,6 @@
src/test/resources/beanRefContext.xml
src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml
src/test/resources/org/springframework/batch/execution/bootstrap/support/test-environment.xml
- src/test/resources/org/springframework/batch/execution/configuration/JobRepoDb2.xml
- src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml
- src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml
- src/test/resources/org/springframework/batch/execution/configuration/JobRepoMissingDataSource.xml
- src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml
- src/test/resources/org/springframework/batch/execution/configuration/JobRepoOk.xml
- src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml
- src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml
- src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemReader.xml
- src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemWriter.xml
- src/test/resources/org/springframework/batch/execution/configuration/StepMissingTransactionManager.xml
- src/test/resources/org/springframework/batch/execution/configuration/StepOk.xml
- src/test/resources/org/springframework/batch/execution/configuration/StepRerunAlways.xml
- src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml
- src/test/resources/org/springframework/batch/execution/configuration/StepRerunNever.xml
- src/test/resources/org/springframework/batch/execution/configuration/StepSpecificTransactionManager.xml
- src/test/resources/org/springframework/batch/execution/configuration/TaskletStepMissingTasklet.xml
- src/test/resources/org/springframework/batch/execution/configuration/TaskletStepOk.xml
- src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunAlways.xml
- src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml
- src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java
index 6f40d8c02..a542a590a 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java
@@ -350,7 +350,7 @@ public class ItemOrientedStep extends AbstractStep {
catch (Exception e) {
fatalException.setException(e);
stepExecution.setStatus(BatchStatus.UNKNOWN);
- throw new CommitFailedException("Fatal error detected during commit", e);
+ throw new CommitFailedException("Fatal error detected during save of step execution context", e);
}
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBean.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBean.java
index 785112c02..d5d9ca488 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBean.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBean.java
@@ -23,26 +23,52 @@ import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.repeat.exception.handler.SimpleLimitExceptionHandler;
+import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;
import org.springframework.batch.repeat.support.RepeatTemplate;
import org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate;
import org.springframework.core.task.TaskExecutor;
/**
- * Adds listeners to {@link SimpleStepFactoryBean}.
+ * Most common configuration options for simple steps should be found here. Use
+ * this factory bean instead of creating a {@link Step} implementation manually.
*
* @author Dave Syer
*
*/
-public class DefaultStepFactoryBean extends SimpleStepFactoryBean {
+public class DefaultStepFactoryBean extends AbstractStepFactoryBean {
private boolean alwaysSkip = false;
+ private int commitInterval = 0;
+
+ private ItemStream[] streams = new ItemStream[0];
+
private BatchListener[] listeners = new BatchListener[0];
private ListenerMulticaster listener = new ListenerMulticaster();
private TaskExecutor taskExecutor;
+ /**
+ * Set the commit interval.
+ *
+ * @param commitInterval
+ */
+ public void setCommitInterval(int commitInterval) {
+ this.commitInterval = commitInterval;
+ }
+
+ /**
+ * The streams to inject into the {@link Step}. Any instance of
+ * {@link ItemStream} can be used, and will then receive callbacks at the
+ * appropriate stage in the step.
+ *
+ * @param streams an array of listeners
+ */
+ public void setStreams(ItemStream[] streams) {
+ this.streams = streams;
+ }
+
/**
* Public setter for a flag that determines skip policy. If this flag is
* true then an exception in chunk processing will cause the item to be
@@ -83,6 +109,15 @@ public class DefaultStepFactoryBean extends SimpleStepFactoryBean {
protected void applyConfiguration(ItemOrientedStep step) {
super.applyConfiguration(step);
+
+ step.setStreams(streams);
+
+ if (commitInterval > 0) {
+ RepeatTemplate chunkOperations = new RepeatTemplate();
+ chunkOperations.setCompletionPolicy(new SimpleCompletionPolicy(commitInterval));
+ step.setChunkOperations(chunkOperations);
+ }
+
for (int i = 0; i < listeners.length; i++) {
BatchListener listener = listeners[i];
if (listener instanceof StepListener) {
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBean.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBean.java
index 3b47aa2a9..b77d1b522 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBean.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBean.java
@@ -26,9 +26,9 @@ import org.springframework.batch.repeat.RepeatOperations;
import org.springframework.batch.repeat.support.RepeatTemplate;
/**
- * Extends a {@link SimpleStepFactoryBean} allowing registration of listeners
- * and also direct injection of the {@link RepeatOperations} needed at step and
- * chunk level.
+ * Factory bean for {@link Step} implementations allowing registration of
+ * listeners and also direct injection of the {@link RepeatOperations} needed at
+ * step and chunk level.
*
* @author Dave Syer
*
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/SimpleStepFactoryBean.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/SimpleStepFactoryBean.java
deleted file mode 100644
index 548da5406..000000000
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/SimpleStepFactoryBean.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2006-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.batch.execution.step.support;
-
-import org.springframework.batch.core.domain.Step;
-import org.springframework.batch.execution.step.ItemOrientedStep;
-import org.springframework.batch.item.ItemStream;
-import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;
-import org.springframework.batch.repeat.support.RepeatTemplate;
-
-/**
- * @author Dave Syer
- *
- */
-public class SimpleStepFactoryBean extends AbstractStepFactoryBean {
-
- private int commitInterval = 0;
-
- private ItemStream[] streams = new ItemStream[0];
-
- /**
- * Set the commit interval.
- *
- * @param commitInterval
- */
- public void setCommitInterval(int commitInterval) {
- this.commitInterval = commitInterval;
- }
-
- /**
- * The streams to inject into the {@link Step}. Any instance of
- * {@link ItemStream} can be used, and will then receive callbacks at the
- * appropriate stage in the step.
- *
- * @param streams an array of listeners
- */
- public void setStreams(ItemStream[] streams) {
- this.streams = streams;
- }
-
- /**
- * @param step
- *
- */
- protected void applyConfiguration(ItemOrientedStep step) {
-
- super.applyConfiguration(step);
-
- step.setStreams(streams);
-
- if (commitInterval > 0) {
- RepeatTemplate chunkOperations = new RepeatTemplate();
- chunkOperations.setCompletionPolicy(new SimpleCompletionPolicy(commitInterval));
- step.setChunkOperations(chunkOperations);
- }
-
- }
-}
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/support/SimpleStepFactoryBeanTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBeanTests.java
similarity index 94%
rename from spring-batch-execution/src/test/java/org/springframework/batch/execution/step/support/SimpleStepFactoryBeanTests.java
rename to spring-batch-execution/src/test/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBeanTests.java
index ce9ef4554..917b457cd 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/support/SimpleStepFactoryBeanTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBeanTests.java
@@ -23,7 +23,7 @@ import org.springframework.batch.core.domain.Step;
* @author Dave Syer
*
*/
-public class SimpleStepFactoryBeanTests extends TestCase {
+public class StatefulRetryStepFactoryBeanTests extends TestCase {
private AbstractStepFactoryBean factory = new StatefulRetryStepFactoryBean();
diff --git a/spring-batch-execution/src/test/resources/job-configuration.xml b/spring-batch-execution/src/test/resources/job-configuration.xml
index 289e54d50..08a4bce53 100644
--- a/spring-batch-execution/src/test/resources/job-configuration.xml
+++ b/spring-batch-execution/src/test/resources/job-configuration.xml
@@ -18,7 +18,7 @@
class="org.springframework.batch.execution.job.JobSupport">
+ class="org.springframework.batch.execution.step.support.DefaultStepFactoryBean">
diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml
index 0a9a26e92..a7c87f72b 100644
--- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml
+++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml
@@ -15,7 +15,7 @@
class="org.springframework.batch.execution.job.JobSupport">
+ class="org.springframework.batch.execution.step.support.DefaultStepFactoryBean">
diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml
index dcb20a8a6..f0f64e17b 100644
--- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml
+++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml
@@ -20,7 +20,7 @@
-
+
diff --git a/spring-batch-samples/src/main/resources/data-source-context.xml b/spring-batch-samples/src/main/resources/data-source-context.xml
index bf37d3f65..949239771 100644
--- a/spring-batch-samples/src/main/resources/data-source-context.xml
+++ b/spring-batch-samples/src/main/resources/data-source-context.xml
@@ -9,7 +9,7 @@
+ class="org.apache.commons.dbcp.BasicDataSource">
diff --git a/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml b/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml
index 33690c6f3..75407f5ee 100644
--- a/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml
index 5846af8f2..c2017d8bb 100644
--- a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml
@@ -4,19 +4,19 @@
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
-
-
-
-
-
-
-
-
-
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
+
+
+
+
+
+
+
+
+
-
+
diff --git a/spring-batch-samples/src/main/resources/jobs/retrySample.xml b/spring-batch-samples/src/main/resources/jobs/retrySample.xml
index c20a3124b..19703d7c0 100644
--- a/spring-batch-samples/src/main/resources/jobs/retrySample.xml
+++ b/spring-batch-samples/src/main/resources/jobs/retrySample.xml
@@ -11,7 +11,7 @@
-
diff --git a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml
index 21a264216..33564da27 100644
--- a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml
@@ -14,7 +14,7 @@
-
+
diff --git a/spring-batch-samples/src/main/resources/log4j.properties b/spring-batch-samples/src/main/resources/log4j.properties
index 54da719b9..802166e7b 100644
--- a/spring-batch-samples/src/main/resources/log4j.properties
+++ b/spring-batch-samples/src/main/resources/log4j.properties
@@ -23,12 +23,12 @@ log4j.rootLogger=info, stdout
### enable spring
log4j.logger.org.springframework=error
-log4j.logger.org.springframework.batch.sample=debug
#log4j.logger.org.springframework.transaction=debug
#log4j.logger.org.springframework.jdbc.core=debug
#log4j.logger.org.springframework.orm=debug
### debug your specific package or classes with the following example
-log4j.logger.org.springframework.batch=debug
+#log4j.logger.org.springframework.batch=debug
+log4j.logger.org.springframework.batch.sample=debug
log4j.logger.org.springframework.batch.sample.module.OrderDataProvider=debug
log4j.logger.org.springframework.batch.container.common.module.process.support.DefaultXmlDataProvider=debug
diff --git a/spring-batch-samples/src/main/resources/simple-container-definition.xml b/spring-batch-samples/src/main/resources/simple-container-definition.xml
index e7702a360..9aa9bcf43 100644
--- a/spring-batch-samples/src/main/resources/simple-container-definition.xml
+++ b/spring-batch-samples/src/main/resources/simple-container-definition.xml
@@ -95,7 +95,7 @@
@@ -103,10 +103,6 @@
-
-