diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java index ef414d6b4..e9dbbc1eb 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java @@ -70,12 +70,12 @@ public class StepParser { @SuppressWarnings("unchecked") List processTaskElements = (List) DomUtils.getChildElementsByTagName(element, "tasklet"); if (StringUtils.hasText(taskletRef)) { - Object task = handleTaskletStep(element, taskletRef, parserContext); + Object task = handleTaskletRef(element, taskletRef, parserContext); stateBuilder.addConstructorArgValue(stepRef); stateBuilder.addConstructorArgValue(task); } else if (processTaskElements.size() > 0) { - Object task = handleChunkOrientedTaskletStep(element, processTaskElements.get(0), parserContext); + Object task = handleTaskletElement(element, processTaskElements.get(0), parserContext); stateBuilder.addConstructorArgValue(stepRef); stateBuilder.addConstructorArgValue(task); } @@ -199,7 +199,7 @@ public class StepParser { * @param parserContext * @return the TaskletStep bean */ - protected RootBeanDefinition handleTaskletStep(Element stepElement, String taskletRef, ParserContext parserContext) { + protected RootBeanDefinition handleTaskletRef(Element stepElement, String taskletRef, ParserContext parserContext) { RootBeanDefinition bd = new RootBeanDefinition("org.springframework.batch.core.step.tasklet.TaskletStep", null, null); @@ -229,7 +229,7 @@ public class StepParser { * @param parserContext * @return the TaskletStep bean */ - protected RootBeanDefinition handleChunkOrientedTaskletStep(Element stepElement, Element element, ParserContext parserContext) { + protected RootBeanDefinition handleTaskletElement(Element stepElement, Element element, ParserContext parserContext) { RootBeanDefinition bd; @@ -265,6 +265,15 @@ public class StepParser { } // now, set the properties on the new bean + String startLimit = element.getAttribute("start-limit"); + if (StringUtils.hasText(startLimit)) { + bd.getPropertyValues().addPropertyValue("startLimit", startLimit); + } + String allowStartIfComplete = element.getAttribute("allow-start-if-complete"); + if (StringUtils.hasText(allowStartIfComplete)) { + bd.getPropertyValues().addPropertyValue("allowStartIfComplete", allowStartIfComplete); + } + String readerBeanId = element.getAttribute("reader"); if (StringUtils.hasText(readerBeanId)) { RuntimeBeanReference readerRef = new RuntimeBeanReference(readerBeanId); diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd index db43ebc1b..0fa26ca47 100644 --- a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd +++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd @@ -335,6 +335,20 @@ ]]> + + + + + + + + + + beans = ctx.getBeansOfType(FaultTolerantStepFactoryBean.class); + String factoryName = (String) beans.keySet().toArray()[0]; + FaultTolerantStepFactoryBean factory = (FaultTolerantStepFactoryBean) beans.get(factoryName); + TaskletStep bean = (TaskletStep) factory.getObject(); + assertEquals("wrong start-limit:", 25, bean.getStartLimit()); + } + @Test public void testTaskletStepWithBadStepListener() throws Exception { loadContextWithBadListener("org/springframework/batch/core/configuration/xml/StepParserBadStepListenerTests-context.xml"); diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml new file mode 100644 index 000000000..9c8c57839 --- /dev/null +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + org.springframework.jdbc.BadSqlGrammarException + + + org.springframework.dao.DataIntegrityViolationException + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file