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

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@ import org.springframework.util.MethodInvoker;
* by {@link InvocationTargetThrowableWrapper}.
*
* @author Robert Kasanicky
* @author Mahmoud Ben Hassine
*/
public abstract class AbstractMethodInvokingDelegator<T> implements InitializingBean {
@@ -213,6 +214,14 @@ public abstract class AbstractMethodInvokingDelegator<T> implements Initializing
this.arguments = arguments == null ? null : Arrays.asList(arguments).toArray();
}
/**
* Return arguments.
* @return arguments
*/
protected Object[] getArguments() {
return arguments;
}
/**
* Used to wrap a {@link Throwable} (not an {@link Exception}) thrown by a
* reflectively-invoked delegate.