From 396b4e45b3dcfef5f5f376be33cce0285fd3a677 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Thu, 11 Mar 2010 22:51:49 +0000 Subject: [PATCH] INT-174 Added ConversionService support for routers. --- .../AbstractChannelNameResolvingMessageRouter.java | 2 +- .../router/AbstractMessageProcessingRouter.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractChannelNameResolvingMessageRouter.java b/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractChannelNameResolvingMessageRouter.java index f001db6b45..f4846b9c57 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractChannelNameResolvingMessageRouter.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractChannelNameResolvingMessageRouter.java @@ -63,7 +63,7 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract } @Override - public final void onInit() { + public void onInit() { Assert.notNull(this.getChannelResolver(), "either a ChannelResolver or BeanFactory is required"); } diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractMessageProcessingRouter.java b/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractMessageProcessingRouter.java index b799e3891a..adb8291992 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractMessageProcessingRouter.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractMessageProcessingRouter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import org.springframework.integration.core.Message; +import org.springframework.integration.handler.AbstractMessageProcessor; import org.springframework.integration.handler.MessageProcessor; import org.springframework.util.Assert; @@ -40,6 +41,14 @@ class AbstractMessageProcessingRouter extends AbstractChannelNameResolvingMessag this.messageProcessor = messageProcessor; } + @Override + public final void onInit() { + super.onInit(); + if (this.messageProcessor instanceof AbstractMessageProcessor) { + ((AbstractMessageProcessor) this.messageProcessor).setConversionService(this.getConversionService()); + } + } + @Override protected List getChannelIndicatorList(Message message) { Object result = this.messageProcessor.processMessage(message);