MessageMappingMethodInvoker no longer implements MethodInvoker (simplified - since it always requires a single Message arg).
This commit is contained in:
@@ -48,7 +48,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class MessageMappingMethodInvoker implements MethodInvoker {
|
||||
public class MessageMappingMethodInvoker {
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(MessageMappingMethodInvoker.class);
|
||||
|
||||
@@ -86,11 +86,8 @@ public class MessageMappingMethodInvoker implements MethodInvoker {
|
||||
}
|
||||
|
||||
|
||||
public Object invokeMethod(Object... args) {
|
||||
Assert.notEmpty(args, "argument array must not be empty");
|
||||
Assert.isTrue(args.length == 1 && args[0] != null && (args[0] instanceof Message),
|
||||
"Argument array must contain a single Message instance.");
|
||||
Message<?> message = (Message<?>) args[0];
|
||||
public Object invokeMethod(Message<?> message) {
|
||||
Assert.notNull(message, "message must not be null");
|
||||
if (message.getPayload() == null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("received null payload");
|
||||
@@ -98,7 +95,7 @@ public class MessageMappingMethodInvoker implements MethodInvoker {
|
||||
return null;
|
||||
}
|
||||
Method method = this.methodResolver.resolveHandlerMethod(message);
|
||||
args = this.createArgumentArrayFromMessage(method, message);
|
||||
Object[] args = this.createArgumentArrayFromMessage(method, message);
|
||||
try {
|
||||
return this.doInvokeMethod(method, args, message);
|
||||
}
|
||||
|
||||
@@ -18,18 +18,16 @@ package org.springframework.integration.handler;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.message.MessageHandlingException;
|
||||
import org.springframework.integration.util.MethodInvoker;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ServiceActivatingHandler extends AbstractReplyProducingMessageHandler implements InitializingBean {
|
||||
public class ServiceActivatingHandler extends AbstractReplyProducingMessageHandler {
|
||||
|
||||
private final MethodInvoker invoker;
|
||||
private final MessageMappingMethodInvoker invoker;
|
||||
|
||||
|
||||
public ServiceActivatingHandler(final Object object) {
|
||||
@@ -45,12 +43,6 @@ public class ServiceActivatingHandler extends AbstractReplyProducingMessageHandl
|
||||
}
|
||||
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (this.invoker instanceof InitializingBean) {
|
||||
((InitializingBean) this.invoker).afterPropertiesSet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleRequestMessage(Message<?> message, ReplyMessageHolder replyHolder) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user