diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/AbstractMessageHandlerFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/AbstractMessageHandlerFactoryBean.java index a0e2fd3e0e..1d7904aebb 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/AbstractMessageHandlerFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/AbstractMessageHandlerFactoryBean.java @@ -80,6 +80,10 @@ abstract class AbstractMessageHandlerFactoryBean implements FactoryBean expectedType = null; - return this.configureHandler(new ServiceActivatingHandler(expression, expectedType)); + ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor(expression); + processor.setBeanFactory(this.getBeanFactory()); + return this.configureHandler(new ServiceActivatingHandler(processor)); } private ServiceActivatingHandler configureHandler(ServiceActivatingHandler handler) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/ServiceActivatingHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/ServiceActivatingHandler.java index 8331deff9f..b86dd761c3 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/ServiceActivatingHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/ServiceActivatingHandler.java @@ -18,7 +18,6 @@ package org.springframework.integration.handler; import java.lang.reflect.Method; -import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.integration.annotation.ServiceActivator; import org.springframework.integration.core.Message; import org.springframework.integration.message.MessageHandlingException; @@ -43,10 +42,8 @@ public class ServiceActivatingHandler extends AbstractReplyProducingMessageHandl this.processor = new MethodInvokingMessageProcessor(object, methodName); } - public ServiceActivatingHandler(String expression, Class expectedType) { - ExpressionEvaluatingMessageProcessor eemp = new ExpressionEvaluatingMessageProcessor(expression); - eemp.setExpectedType(expectedType); - this.processor = eemp; + public ServiceActivatingHandler(AbstractMessageProcessor processor) { + this.processor = processor; } @@ -58,9 +55,6 @@ public class ServiceActivatingHandler extends AbstractReplyProducingMessageHandl @Override public final void onInit() { this.processor.setConversionService(this.getConversionService()); - if (this.processor instanceof BeanFactoryAware) { - ((BeanFactoryAware) this.processor).setBeanFactory(this.getBeanFactory()); - } } @Override