diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractStepParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractStepParser.java index 8d32d1f0b..49d1c5625 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractStepParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractStepParser.java @@ -243,6 +243,10 @@ public abstract class AbstractStepParser { RuntimeBeanReference taskExecutorRef = new RuntimeBeanReference(taskExecutorBeanId); propertyValues.addPropertyValue("taskExecutor", taskExecutorRef); } + String throttleLimit = taskletElement.getAttribute("throttle-limit"); + if (StringUtils.hasText(throttleLimit)) { + propertyValues.addPropertyValue("throttleLimit", throttleLimit); + } } @SuppressWarnings("unchecked") diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.1.xsd b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.1.xsd index 563290991..0d30980fc 100644 --- a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.1.xsd +++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.1.xsd @@ -352,6 +352,15 @@ + + + + + @@ -585,15 +594,6 @@ ]]> - - - - - fb = new StepParserStepFactoryBean(); fb.setBeanName("step1"); fb.setAllowStartIfComplete(true); @@ -202,13 +202,17 @@ public class StepParserStepFactoryBeanTests { fb.setIsReaderTransactionalQueue(true); fb.setRetryLimit(5); fb.setSkipLimit(100); + fb.setThrottleLimit(10); fb.setRetryListeners(new RetryListenerSupport()); fb.setSkippableExceptionClasses(new HashMap, Boolean>()); fb.setRetryableExceptionClasses(new HashMap, Boolean>()); Object step = fb.getObject(); assertTrue(step instanceof TaskletStep); + Object throttleLimit = ReflectionTestUtils.getField(ReflectionTestUtils.getField(step, "stepOperations"), "throttleLimit"); + assertEquals(new Integer(10), throttleLimit); Object tasklet = ReflectionTestUtils.getField(step, "tasklet"); assertTrue(tasklet instanceof ChunkOrientedTasklet); } + } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java index 925258561..f109f955d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java @@ -88,6 +88,8 @@ public class StepParserTests { StepParserStepFactoryBean factory = beans.get(factoryName); TaskletStep bean = (TaskletStep) factory.getObject(); assertEquals("wrong start-limit:", 25, bean.getStartLimit()); + Object throttleLimit = ReflectionTestUtils.getField(factory, "throttleLimit"); + assertEquals(new Integer(10), throttleLimit); } @Test 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 index 7a8b4c1cb..0c77af0a7 100644 --- 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 @@ -6,7 +6,7 @@ - +