Conditionally add custom scopes when using XML configuration

When using a combination of Java configuration and the XML namespace
configuration, prior to this commit, we would add the batch custom
scopes twice which lead to issues.  This commit gives priority to the
custom scopes provided by the java configuration.  If you've used
@EnableBatchProcessing and have configured batch components using the
batch namespace, the custom scopes that come with the java config will
take precidence.

This commit addresses Jira BATCH-2266
This commit is contained in:
Michael Minella
2014-09-22 13:45:43 -05:00
parent fc2431332b
commit a2f2df0b17
4 changed files with 71 additions and 16 deletions

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 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-3.1.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
<bean id="tasklet" class="org.springframework.batch.core.configuration.annotation.StepScopeConfigurationTests$TaskletSupport"/>
<job id="job" xmlns="http://www.springframework.org/schema/batch">
<step id="step1">
<tasklet ref="tasklet"/>
</step>
</job>
<bean id="xmlValue" class="org.springframework.batch.core.configuration.annotation.StepScopeConfigurationTests.SimpleHolder" scope="step">
<constructor-arg value="#{stepExecution.stepName}" />
</bean>
</beans>