diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd b/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd index 42a95e61f1..826ad28c4f 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd @@ -147,7 +147,7 @@ - + @@ -357,7 +357,7 @@ - + diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java index 31a696e12d..8926f27ae6 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java @@ -20,7 +20,6 @@ import java.lang.reflect.Method; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; - import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.support.AopUtils; import org.springframework.beans.SimpleTypeConverter; @@ -121,22 +120,27 @@ public class GatewayProxyFactoryBean extends SimpleMessagingGateway } Method method = invocation.getMethod(); Class returnType = method.getReturnType(); - boolean shouldReturnMessage = Message.class.isAssignableFrom(returnType); + boolean isReturnTypeMessage = Message.class.isAssignableFrom(returnType); + boolean shouldReply = returnType != void.class; int paramCount = method.getParameterTypes().length; Object response = null; if (paramCount == 0) { - if (shouldReturnMessage) { - return this.receive(); + if (shouldReply) { + if (isReturnTypeMessage) { + return this.receive(); + } + response = this.receive(); } - response = this.receive(); } else { Object payload = (paramCount == 1) ? invocation.getArguments()[0] : invocation.getArguments(); - if (returnType.equals(void.class)) { - this.send(payload); - return null; + if (shouldReply) { + response = isReturnTypeMessage ? this.sendAndReceiveMessage(payload) : this.sendAndReceive(payload); + } + else { + this.send(payload); + response = null; } - response = shouldReturnMessage ? this.sendAndReceiveMessage(payload) : this.sendAndReceive(payload); } return (response != null) ? this.typeConverter.convertIfNecessary(response, returnType) : null; }