BATCH-2397: fix parameters handling in MethodInvokingTaskletAdapter

When a tasklet is declared with xml using the shortcut version, the
MethodInvokingTaskletAdapter that is created automatically does not
address passing parameters expected by Tasklet#execute (which is
incorrect since the documentation of the schema attribute "method"
says the bean should define a method with the same signature).

This commit fixes parameters passing when using the shortcut version.

Resolves BATCH-2397
This commit is contained in:
Mahmoud Ben Hassine
2018-01-24 16:52:17 +01:00
committed by Michael Minella
parent 0d9f4ce6f1
commit 79f3a67883
5 changed files with 300 additions and 4 deletions

View File

@@ -16,11 +16,18 @@
p:proxyTargetClass="true" />
<job id="loopJob" xmlns="http://www.springframework.org/schema/batch">
<step id="step1">
<!-- this step tests the usage of MethodInvokingTaskletAdapter declared as a bean -->
<step id="step1" next="step2">
<tasklet ref="adapter">
<transaction-attributes propagation="REQUIRED"/>
</tasklet>
</step>
<!-- this step tests the shortcut version that automatically wraps a bean
in a MethodInvokingTaskletAdapter -->
<step id="step2">
<tasklet ref="task" method="doWork"/>
</step>
</job>
<bean id="adapter"
@@ -41,4 +48,7 @@
scope="step">
<property name="value" value="#{jobParameters[value]}" />
</bean>
<bean id="task" class="org.springframework.batch.sample.TaskletJobFunctionalTests$Task"/>
</beans>