diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/InlineStepParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/InlineStepParser.java index 4d25143e4..140b01f01 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/InlineStepParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/InlineStepParser.java @@ -60,6 +60,9 @@ public class InlineStepParser extends AbstractStepParser { @SuppressWarnings("unchecked") List listOfTaskElements = (List) DomUtils.getChildElementsByTagName(element, "tasklet"); + @SuppressWarnings("unchecked") + List listOfListenersElements = (List) DomUtils.getChildElementsByTagName(element, "listeners"); + if (StringUtils.hasText(stepRef)) { if (StringUtils.hasText(taskletRef)) { parserContext.getReaderContext().error("The 'tasklet' attribute can't be combined with the 'ref=\""+ stepRef +"\"' attribute specification for <" + element.getNodeName() + ">", element); @@ -68,6 +71,9 @@ public class InlineStepParser extends AbstractStepParser { parserContext.getReaderContext().error("The <" + listOfTaskElements.get(0).getNodeName() + "> element can't be combined with the 'ref=\""+ stepRef +"\"' attribute specification for <" + element.getNodeName() + ">", element); } + if (listOfListenersElements.size() > 0) { + parserContext.getReaderContext().error("The 'listeners' element can't be combined with the 'ref=\""+ stepRef +"\"' attribute specification for <" + element.getNodeName() + ">", element); + } BeanDefinitionBuilder stepBuilder = BeanDefinitionBuilder.genericBeanDefinition("org.springframework.batch.core.configuration.xml.DelegatingStep"); stepBuilder.addConstructorArgValue(stepId);