diff --git a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpOutboundChannelAdapterParserTests.java b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpOutboundChannelAdapterParserTests.java
index c6ea61a3a5..5a9b950c4f 100644
--- a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpOutboundChannelAdapterParserTests.java
+++ b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpOutboundChannelAdapterParserTests.java
@@ -36,6 +36,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
+
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.connection.Connection;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
@@ -56,13 +57,13 @@ import org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint;
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.NullChannel;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.PollableChannel;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/AbstractSimpleMessageHandlerFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/AbstractSimpleMessageHandlerFactoryBean.java
index 779e03f0e2..a5e8370938 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/AbstractSimpleMessageHandlerFactoryBean.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/AbstractSimpleMessageHandlerFactoryBean.java
@@ -16,6 +16,7 @@ package org.springframework.integration.config;
import java.util.List;
import org.aopalliance.aop.Advice;
+
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
@@ -24,7 +25,6 @@ import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.context.IntegrationObjectSupport;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.context.Orderable;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.MessageProducer;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractOutboundGatewayParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractOutboundGatewayParser.java
index 6e2ba83b1a..e5bcacff75 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractOutboundGatewayParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractOutboundGatewayParser.java
@@ -18,8 +18,6 @@ package org.springframework.integration.config.xml;
import org.w3c.dom.Element;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.util.StringUtils;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationObjectSupport.java b/spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationObjectSupport.java
index 651611cea8..3852267b36 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationObjectSupport.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationObjectSupport.java
@@ -18,6 +18,7 @@ package org.springframework.integration.context;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
@@ -27,6 +28,7 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.convert.ConversionService;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/EventDrivenConsumer.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/EventDrivenConsumer.java
index 1ffc5c9053..4ab36be2f1 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/EventDrivenConsumer.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/EventDrivenConsumer.java
@@ -18,9 +18,9 @@ package org.springframework.integration.endpoint;
import org.springframework.context.Lifecycle;
import org.springframework.integration.context.IntegrationObjectSupport;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.SubscribableChannel;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
index fd550f7fd1..2250e40527 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
@@ -19,11 +19,11 @@ package org.springframework.integration.endpoint;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessagingException;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.history.TrackableComponent;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.integration.transaction.IntegrationResourceHolder;
import org.springframework.util.Assert;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java
index 000051f8ed..e52c4d393b 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java
@@ -16,15 +16,16 @@
package org.springframework.integration.handler;
-import org.springframework.aop.framework.Advised;
-import org.springframework.aop.support.AopUtils;
+import java.util.HashSet;
+import java.util.List;
+import java.util.concurrent.locks.ReentrantLock;
+
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.SmartLifecycle;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageHandlingException;
-import org.springframework.integration.context.IntegrationObjectSupport;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.MessageProducer;
import org.springframework.integration.filter.MessageFilter;
@@ -32,10 +33,6 @@ import org.springframework.integration.support.channel.BeanFactoryChannelResolve
import org.springframework.integration.support.channel.ChannelResolver;
import org.springframework.util.Assert;
-import java.util.HashSet;
-import java.util.List;
-import java.util.concurrent.locks.ReentrantLock;
-
/**
* A composite {@link MessageHandler} implementation that invokes a chain of
* MessageHandler instances in order.
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistory.java b/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistory.java
index 7087b6e6e1..107463385a 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistory.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistory.java
@@ -26,8 +26,8 @@ import java.util.ListIterator;
import java.util.Properties;
import org.springframework.integration.Message;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/history/TrackableComponent.java b/spring-integration-core/src/main/java/org/springframework/integration/history/TrackableComponent.java
index 000f7c2762..1c49dbc381 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/history/TrackableComponent.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/history/TrackableComponent.java
@@ -16,7 +16,7 @@
package org.springframework.integration.history;
-import org.springframework.integration.context.NamedComponent;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonToObjectTransformer.java b/spring-integration-core/src/main/java/org/springframework/integration/json/JsonToObjectTransformer.java
index 30d8c5d828..6bbf10ec2f 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonToObjectTransformer.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/json/JsonToObjectTransformer.java
@@ -16,6 +16,9 @@
package org.springframework.integration.json;
+import org.springframework.integration.support.json.JacksonJsonObjectMapper;
+import org.springframework.integration.support.json.JacksonJsonObjectMapperProvider;
+import org.springframework.integration.support.json.JsonObjectMapper;
import org.springframework.integration.transformer.AbstractPayloadTransformer;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/ObjectToJsonTransformer.java b/spring-integration-core/src/main/java/org/springframework/integration/json/ObjectToJsonTransformer.java
index 8a212a7b03..402d64fb2a 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/ObjectToJsonTransformer.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/json/ObjectToJsonTransformer.java
@@ -18,6 +18,9 @@ package org.springframework.integration.json;
import org.springframework.integration.Message;
import org.springframework.integration.MessageHeaders;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.json.JacksonJsonObjectMapper;
+import org.springframework.integration.support.json.JacksonJsonObjectMapperProvider;
+import org.springframework.integration.support.json.JsonObjectMapper;
import org.springframework.integration.transformer.AbstractTransformer;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/context/NamedComponent.java b/spring-integration-core/src/main/java/org/springframework/integration/support/context/NamedComponent.java
similarity index 93%
rename from spring-integration-core/src/main/java/org/springframework/integration/context/NamedComponent.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/context/NamedComponent.java
index 64116f7da7..6880c2d8ea 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/context/NamedComponent.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/context/NamedComponent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.context;
+package org.springframework.integration.support.context;
/**
* @author Mark Fisher
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/context/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/support/context/package-info.java
new file mode 100644
index 0000000000..f09916fdaa
--- /dev/null
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/context/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides classes supporting use of the application context.
+ */
+package org.springframework.integration.support.context;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/AbstractJacksonJsonMessageParser.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/AbstractJacksonJsonMessageParser.java
similarity index 59%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/AbstractJacksonJsonMessageParser.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/AbstractJacksonJsonMessageParser.java
index 4ab1297313..e291e95f4e 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/AbstractJacksonJsonMessageParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/AbstractJacksonJsonMessageParser.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import org.springframework.integration.Message;
import org.springframework.integration.support.MessageBuilder;
@@ -30,9 +30,9 @@ import org.springframework.integration.support.MessageBuilder;
*/
abstract class AbstractJacksonJsonMessageParser
implements JsonInboundMessageMapper.JsonMessageParser
{
- protected final JsonObjectMapper
objectMapper;
+ private final JsonObjectMapper
objectMapper;
- protected volatile JsonInboundMessageMapper messageMapper;
+ private volatile JsonInboundMessageMapper messageMapper;
protected AbstractJacksonJsonMessageParser(JsonObjectMapper
objectMapper) {
this.objectMapper = objectMapper;
@@ -44,22 +44,36 @@ abstract class AbstractJacksonJsonMessageParser
implements JsonInboundMessage
this.messageMapper = messageMapper;
}
P parser = this.createJsonParser(jsonMessage);
+
if (messageMapper.isMapToPayload()) {
- try {
- return MessageBuilder.withPayload(this.readPayload(parser)).build();
- }
- catch (Exception ex) {
- throw new IllegalArgumentException("Mapping of JSON message " + jsonMessage +
- " directly to payload of type " + messageMapper.getPayloadType() + " failed.", ex);
- }
+ Object payload = this.readPayload(parser, jsonMessage);
+ return MessageBuilder.withPayload(payload).build();
}
else {
return this.parseWithHeaders(parser, jsonMessage);
}
}
- protected Object readPayload(P parser) throws Exception {
- return objectMapper.fromJson(parser, this.messageMapper.getPayloadType());
+ protected Object readPayload(P parser, String jsonMessage) throws Exception {
+ try {
+ return objectMapper.fromJson(parser, this.messageMapper.getPayloadType());
+ }
+ catch (Exception e) {
+ throw new IllegalArgumentException("Mapping of JSON message '" + jsonMessage +
+ "' to payload type '" + messageMapper.getPayloadType() + "' failed.", e);
+ }
+ }
+
+ protected Object readHeader(P parser, String headerName, String jsonMessage) throws Exception {
+ Class> headerType = this.messageMapper.getHeaderTypes().containsKey(headerName) ?
+ this.messageMapper.getHeaderTypes().get(headerName) : Object.class;
+ try {
+ return this.objectMapper.fromJson(parser, headerType);
+ }
+ catch (Exception e) {
+ throw new IllegalArgumentException("Mapping header '" + headerName + "' of JSON message '" +
+ jsonMessage + "' to header type '" + headerType + "' failed.", e);
+ }
}
protected abstract Message> parseWithHeaders(P parser, String jsonMessage) throws Exception;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/AbstractJsonInboundMessageMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/AbstractJsonInboundMessageMapper.java
similarity index 97%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/AbstractJsonInboundMessageMapper.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/AbstractJsonInboundMessageMapper.java
index c5d2102135..7492b7149d 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/AbstractJsonInboundMessageMapper.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/AbstractJsonInboundMessageMapper.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import java.lang.reflect.Type;
import java.util.HashMap;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/Jackson2JsonMessageParser.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonMessageParser.java
similarity index 68%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/Jackson2JsonMessageParser.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonMessageParser.java
index 90b1748bda..e2b293a732 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/Jackson2JsonMessageParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonMessageParser.java
@@ -14,21 +14,20 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import java.util.LinkedHashMap;
import java.util.Map;
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.JsonMappingException;
-
import org.springframework.integration.Message;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.util.Assert;
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+
/**
* {@link JsonInboundMessageMapper.JsonMessageParser} implementation that parses JSON messages
* and builds a {@link Message} with the specified payload type from provided {@link JsonInboundMessageMapper}.
@@ -37,7 +36,7 @@ import org.springframework.util.Assert;
* @author Artem Bilan
* @since 3.0
*/
-class Jackson2JsonMessageParser extends AbstractJacksonJsonMessageParser {
+public class Jackson2JsonMessageParser extends AbstractJacksonJsonMessageParser {
public Jackson2JsonMessageParser() {
super(new Jackson2JsonObjectMapper());
@@ -51,11 +50,11 @@ class Jackson2JsonMessageParser extends AbstractJacksonJsonMessageParser parseWithHeaders(JsonParser parser, String jsonMessage) throws Exception {
String error = AbstractJsonInboundMessageMapper.MESSAGE_FORMAT_ERROR + jsonMessage;
- Assert.isTrue(parser.nextToken() == JsonToken.START_OBJECT, error);
+ Assert.isTrue(JsonToken.START_OBJECT == parser.nextToken(), error);
Map headers = null;
Object payload = null;
- while (parser.nextToken() != JsonToken.END_OBJECT) {
- Assert.isTrue(parser.getCurrentToken() == JsonToken.FIELD_NAME, error);
+ while (JsonToken.END_OBJECT != parser.nextToken()) {
+ Assert.isTrue(JsonToken.FIELD_NAME == parser.getCurrentToken(), error);
boolean isHeadersToken = "headers".equals(parser.getCurrentName());
boolean isPayloadToken = "payload".equals(parser.getCurrentName());
Assert.isTrue(isHeadersToken || isPayloadToken, error);
@@ -65,13 +64,7 @@ class Jackson2JsonMessageParser extends AbstractJacksonJsonMessageParser readHeaders(JsonParser parser, String jsonMessage) throws Exception {
Map headers = new LinkedHashMap();
- while (parser.nextToken() != JsonToken.END_OBJECT) {
+ while (JsonToken.END_OBJECT != parser.nextToken()) {
String headerName = parser.getCurrentName();
parser.nextToken();
- Class> headerType = this.messageMapper.getHeaderTypes().containsKey(headerName) ?
- this.messageMapper.getHeaderTypes().get(headerName) : Object.class;
- try {
- headers.put(headerName, this.objectMapper.fromJson(parser, headerType));
- }
- catch (JsonMappingException ex) {
- throw new IllegalArgumentException("Mapping header \"" + headerName + "\" of JSON message " +
- jsonMessage + " to header type " + messageMapper.getPayloadType() + " failed.", ex);
- }
+ Object headerValue = this.readHeader(parser, headerName, jsonMessage);
+ headers.put(headerName, headerValue);
}
return headers;
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/Jackson2JsonObjectMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java
similarity index 97%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/Jackson2JsonObjectMapper.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java
index a543f7feeb..14bcb1d32b 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/Jackson2JsonObjectMapper.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/Jackson2JsonObjectMapper.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import java.io.Reader;
import java.io.Writer;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonMessageParser.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonMessageParser.java
similarity index 74%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonMessageParser.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonMessageParser.java
index b081cb48d3..f86b173368 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonMessageParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonMessageParser.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -22,7 +22,7 @@ import java.util.Map;
import org.codehaus.jackson.JsonFactory;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.map.JsonMappingException;
+
import org.springframework.integration.Message;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.util.Assert;
@@ -35,9 +35,9 @@ import org.springframework.util.Assert;
* @author Artem Bilan
* @since 3.0
*/
-class JacksonJsonMessageParser extends AbstractJacksonJsonMessageParser {
+public class JacksonJsonMessageParser extends AbstractJacksonJsonMessageParser {
- JacksonJsonMessageParser() {
+ public JacksonJsonMessageParser() {
super(new JacksonJsonObjectMapper());
}
@@ -63,13 +63,7 @@ class JacksonJsonMessageParser extends AbstractJacksonJsonMessageParser headerType = this.messageMapper.getHeaderTypes().containsKey(headerName) ?
- this.messageMapper.getHeaderTypes().get(headerName) : Object.class;
- try {
- headers.put(headerName, this.objectMapper.fromJson(parser, headerType));
- }
- catch (JsonMappingException ex) {
- throw new IllegalArgumentException("Mapping header \"" + headerName + "\" of JSON message " +
- jsonMessage + " to header type " + messageMapper.getPayloadType() + " failed.", ex);
- }
+ Object headerValue = this.readHeader(parser, headerName, jsonMessage);
+ headers.put(headerName, headerValue);
}
return headers;
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonObjectMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonObjectMapper.java
similarity index 97%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonObjectMapper.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonObjectMapper.java
index f769e66052..7b3ded0ac9 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonObjectMapper.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonObjectMapper.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import java.io.Reader;
import java.io.Writer;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonObjectMapperProvider.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonObjectMapperProvider.java
new file mode 100644
index 0000000000..549516855d
--- /dev/null
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonObjectMapperProvider.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2002-2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.support.json;
+
+
+/**
+ * Simple factory to provide {@linkplain Jackson2JsonObjectMapper} or {@linkplain JacksonJsonObjectMapper}
+ * instances dependently of jackson-databind or jackson-mapper-asl libs in the classpath.
+ * If there are both libs in the classpath, it prefers Jackson 2 JSON-processor implementation.
+ * If there is not any of them, {@linkplain IllegalStateException} will be thrown.
+ *
+ * @author Artem Bilan
+ * @author Gary Russell
+ * @since 3.0
+ *
+ * @see Jackson2JsonObjectMapper
+ * @see JacksonJsonObjectMapper
+ */
+public final class JacksonJsonObjectMapperProvider {
+
+ public static JsonObjectMapper> newInstance() {
+ if (JacksonJsonUtils.isJackson2Present()) {
+ return new Jackson2JsonObjectMapper();
+ }
+ if(JacksonJsonUtils.isJacksonPresent()) {
+ return new JacksonJsonObjectMapper();
+ }
+ throw JacksonJsonUtils.getNoJacksonLibException();
+ }
+
+}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonObjectMapperProvider.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java
similarity index 53%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonObjectMapperProvider.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java
index 9a8818d0e8..007fc92acb 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/JacksonJsonObjectMapperProvider.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java
@@ -14,27 +14,21 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import org.springframework.util.ClassUtils;
/**
- * Simple factory to provide {@linkplain Jackson2JsonObjectMapper} or {@linkplain JacksonJsonObjectMapper}
- * instances dependently of jackson-databind or jackson-mapper-asl libs in the classpath.
- * If there are both libs in the classpath, it prefers Jackson 2 JSON-processor implementation.
- * If there is no any of them, {@linkplain IllegalStateException} will be thrown.
+ * Utility methods for Jackson.
*
* @author Artem Bilan
+ * @author Gary Russell
* @since 3.0
*
- * @see Jackson2JsonObjectMapper
- * @see JacksonJsonObjectMapper
- * @see JsonToObjectTransformer
- * @see ObjectToJsonTransformer
*/
-public final class JacksonJsonObjectMapperProvider {
+public final class JacksonJsonUtils {
- private static final ClassLoader classLoader = JacksonJsonObjectMapperProvider.class.getClassLoader();
+ private static final ClassLoader classLoader = JacksonJsonUtils.class.getClassLoader();
private static final boolean jackson2Present =
ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader) &&
@@ -47,24 +41,15 @@ public final class JacksonJsonObjectMapperProvider {
private static final IllegalStateException NO_JACKSON_LIB_EXCEPTION =
new IllegalStateException("Neither jackson-databind.jar, nor jackson-mapper-asl.jar aren't presented in the classpath.");
- public static JsonObjectMapper> newInstance() {
- if (jackson2Present) {
- return new Jackson2JsonObjectMapper();
- }
- if(jacksonPresent) {
- return new JacksonJsonObjectMapper();
- }
- throw NO_JACKSON_LIB_EXCEPTION;
+ public static boolean isJackson2Present() {
+ return jackson2Present;
}
- public static JsonInboundMessageMapper.JsonMessageParser> newJsonMessageParser() {
- if (jackson2Present) {
- return new Jackson2JsonMessageParser();
- }
- if(jacksonPresent) {
- return new Jackson2JsonMessageParser();
- }
- throw NO_JACKSON_LIB_EXCEPTION;
+ public static boolean isJacksonPresent() {
+ return jacksonPresent;
}
+ public static IllegalStateException getNoJacksonLibException() {
+ return NO_JACKSON_LIB_EXCEPTION;
+ }
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonInboundMessageMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonInboundMessageMapper.java
similarity index 76%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/JsonInboundMessageMapper.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonInboundMessageMapper.java
index 5126e629d5..299e302915 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonInboundMessageMapper.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonInboundMessageMapper.java
@@ -14,45 +14,38 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import java.lang.reflect.Type;
import java.util.Map;
import org.springframework.integration.Message;
+import org.springframework.integration.support.json.JsonInboundMessageMapper.JsonMessageParser;
+import org.springframework.util.Assert;
/**
* {@link org.springframework.integration.mapping.InboundMessageMapper} implementation that maps incoming JSON messages
* to a {@link Message} with the specified payload type.
- * By default it uses {@link JacksonJsonObjectMapperProvider} to get Jackson or Jackson 2 {@link JsonMessageParser}
- * implementation dependently from classpath.
- * Any other {@link JsonMessageParser} implementation may be provided through the appropriate constructor.
*
* @author Jeremy Grelle
* @author Oleg Zhurakousky
* @author Mark Fisher
* @author Artem Bilan
+ * @author Gary Russell
* @since 2.0
*/
-public class JsonInboundMessageMapper extends AbstractJsonInboundMessageMapper> {
+public class JsonInboundMessageMapper extends AbstractJsonInboundMessageMapper> {
private volatile JsonMessageParser> messageParser;
- public JsonInboundMessageMapper(Class> payloadType) {
- this((Type) payloadType);
- }
-
- public JsonInboundMessageMapper(Type payloadType) {
- this(payloadType, null);
- }
-
public JsonInboundMessageMapper(Class> payloadType, JsonMessageParser> messageParser) {
this((Type) payloadType, messageParser);
}
public JsonInboundMessageMapper(Type payloadType, JsonMessageParser> messageParser) {
super(payloadType);
- this.messageParser = messageParser != null ? messageParser : JacksonJsonObjectMapperProvider.newJsonMessageParser();
+ Assert.notNull(messageParser, "'messageParser' cannot be null");
+ this.messageParser = messageParser;
}
public boolean isMapToPayload() {
@@ -83,7 +76,6 @@ public class JsonInboundMessageMapper extends AbstractJsonInboundMessageMapper {
Message> doInParser(JsonInboundMessageMapper messageMapper, String jsonMessage) throws Exception;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonObjectMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapper.java
similarity index 87%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/JsonObjectMapper.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapper.java
index 63df16a0d1..682f7c0720 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonObjectMapper.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapper.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import java.io.Reader;
import java.io.Writer;
@@ -26,10 +26,6 @@ import java.lang.reflect.Type;
* @author Artem Bilan
* @since 3.0
*
- * @see JsonToObjectTransformer
- * @see ObjectToJsonTransformer
- * @see JacksonJsonObjectMapper
- * @see Jackson2JsonObjectMapper
*/
public interface JsonObjectMapper {
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonObjectMapperAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperAdapter.java
similarity index 96%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/JsonObjectMapperAdapter.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperAdapter.java
index 5d4728cd39..8f7f1282f1 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonObjectMapperAdapter.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperAdapter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import java.io.Reader;
import java.io.Writer;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonOutboundMessageMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonOutboundMessageMapper.java
similarity index 97%
rename from spring-integration-core/src/main/java/org/springframework/integration/json/JsonOutboundMessageMapper.java
rename to spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonOutboundMessageMapper.java
index ab2f233145..03c93efc17 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonOutboundMessageMapper.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonOutboundMessageMapper.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.json;
+package org.springframework.integration.support.json;
import org.springframework.integration.Message;
import org.springframework.integration.mapping.OutboundMessageMapper;
import org.springframework.util.Assert;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/package-info.java
new file mode 100644
index 0000000000..b2e90eb814
--- /dev/null
+++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides classes supporting json.
+ */
+package org.springframework.integration.support.json;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformingHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformingHandler.java
index e957075aba..cb6289ea49 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformingHandler.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformingHandler.java
@@ -18,9 +18,9 @@ package org.springframework.integration.transformer;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.integration.Message;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.util.Assert;
/**
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java
index ce7b65e059..23e9930704 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java
@@ -20,8 +20,8 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import org.springframework.integration.json.JacksonJsonObjectMapperProvider;
-import org.springframework.integration.json.JsonObjectMapper;
+import org.springframework.integration.support.json.JacksonJsonObjectMapperProvider;
+import org.springframework.integration.support.json.JsonObjectMapper;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-3.0.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-3.0.xsd
index eaa15525f6..42c0449cdc 100644
--- a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-3.0.xsd
+++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-3.0.xsd
@@ -2150,7 +2150,7 @@
@@ -2197,7 +2197,7 @@
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/core/MessageHistoryTests.java b/spring-integration-core/src/test/java/org/springframework/integration/core/MessageHistoryTests.java
index 67c175c797..83f91e4785 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/core/MessageHistoryTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/core/MessageHistoryTests.java
@@ -25,10 +25,10 @@ import java.util.Properties;
import org.junit.Test;
import org.springframework.integration.Message;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.context.NamedComponent;
/**
* @author Mark Fisher
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonInboundMessageMapperTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonInboundMessageMapperTests.java
similarity index 90%
rename from spring-integration-core/src/test/java/org/springframework/integration/json/JsonInboundMessageMapperTests.java
rename to spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonInboundMessageMapperTests.java
index 81b587bc57..37e25b36f7 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonInboundMessageMapperTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonInboundMessageMapperTests.java
@@ -29,17 +29,23 @@ import java.util.UUID;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.junit.Test;
+
import org.springframework.integration.Message;
import org.springframework.integration.message.MessageMatcher;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.json.JacksonJsonObjectMapperProvider;
+import org.springframework.integration.support.json.JsonInboundMessageMapper;
+import org.springframework.integration.support.json.JsonInboundMessageMapper.JsonMessageParser;
+import org.springframework.integration.support.json.JsonObjectMapper;
/**
* @author Jeremy Grelle
* @author Mark Fisher
* @author Dave Syer
* @author Artem Bilan
+ * @author Gary Russell
*/
-public class JsonInboundMessageMapperTests {
+public abstract class AbstractJsonInboundMessageMapperTests {
private final JsonObjectMapper> mapper = JacksonJsonObjectMapperProvider.newInstance();
@@ -54,7 +60,7 @@ public class JsonInboundMessageMapperTests {
UUID id = UUID.randomUUID();
String jsonMessage = "{\"headers\":{\"timestamp\":1,\"id\":\"" + id + "\",\"foo\":123,\"bar\":\"abc\"},\"payload\":\"myPayloadStuff\"}";
Message expected = MessageBuilder.withPayload("myPayloadStuff").setHeader("foo", 123).setHeader("bar", "abc").build();
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class, getParser());
Message> result = mapper.toMessage(jsonMessage);
assertThat(result, sameExceptImmutableHeaders(expected));
}
@@ -63,7 +69,7 @@ public class JsonInboundMessageMapperTests {
public void testToMessageWithStringPayload() throws Exception {
String jsonMessage = "\"myPayloadStuff\"";
String expected = "myPayloadStuff";
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class, getParser());
mapper.setMapToPayload(true);
Message> result = mapper.toMessage(jsonMessage);
assertEquals(expected, result.getPayload());
@@ -75,7 +81,7 @@ public class JsonInboundMessageMapperTests {
UUID id = UUID.randomUUID();
String jsonMessage = "{\"headers\":{\"timestamp\":1,\"id\":\"" + id + "\",\"foo\":123,\"bar\":\"abc\"},\"payload\":" + getBeanAsJson(bean) + "}";
Message expected = MessageBuilder.withPayload(bean).setHeader("foo", 123).setHeader("bar", "abc").build();
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(TestBean.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(TestBean.class, getParser());
Message> result = mapper.toMessage(jsonMessage);
assertThat(result, sameExceptImmutableHeaders(expected));
}
@@ -84,7 +90,7 @@ public class JsonInboundMessageMapperTests {
public void testToMessageWithBeanPayload() throws Exception {
TestBean expected = new TestBean();
String jsonMessage = getBeanAsJson(expected);
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(TestBean.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(TestBean.class, getParser());
mapper.setMapToPayload(true);
Message> result = mapper.toMessage(jsonMessage);
assertEquals(expected, result.getPayload());
@@ -96,7 +102,7 @@ public class JsonInboundMessageMapperTests {
UUID id = UUID.randomUUID();
String jsonMessage = "{\"headers\":{\"timestamp\":1,\"id\":\"" + id + "\", \"myHeader\":" + getBeanAsJson(bean) + "},\"payload\":\"myPayloadStuff\"}";
Message expected = MessageBuilder.withPayload("myPayloadStuff").setHeader("myHeader", bean).build();
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class, getParser());
Map> headerTypes = new HashMap>();
headerTypes.put("myHeader", TestBean.class);
mapper.setHeaderTypes(headerTypes);
@@ -110,7 +116,7 @@ public class JsonInboundMessageMapperTests {
String jsonMessage = "{\"headers\":{\"timestamp\":1,\"id\":\"" + id + "\",\"foo\":123,\"bar\":\"abc\"},\"payload\":[\"myPayloadStuff1\",\"myPayloadStuff2\",\"myPayloadStuff3\"]}";
List expectedList = Arrays.asList("myPayloadStuff1", "myPayloadStuff2", "myPayloadStuff3");
Message> expected = MessageBuilder.withPayload(expectedList).setHeader("foo", 123).setHeader("bar", "abc").build();
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(new ParameterizedTypeReference>(){}.getType());
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(new ParameterizedTypeReference>(){}.getType(), getParser());
Message> result = mapper.toMessage(jsonMessage);
assertThat(result, sameExceptImmutableHeaders(expected));
}
@@ -123,7 +129,7 @@ public class JsonInboundMessageMapperTests {
String jsonMessage = "{\"headers\":{\"timestamp\":1,\"id\":\"" + id + "\",\"foo\":123,\"bar\":\"abc\"},\"payload\":[" + getBeanAsJson(bean1) + "," + getBeanAsJson(bean2) + "]}";
List expectedList = Arrays.asList(bean1, bean2);
Message> expected = MessageBuilder.withPayload(expectedList).setHeader("foo", 123).setHeader("bar", "abc").build();
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(new ParameterizedTypeReference>(){}.getType());
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(new ParameterizedTypeReference>(){}.getType(), getParser());
Message> result = mapper.toMessage(jsonMessage);
assertThat(result, sameExceptImmutableHeaders(expected));
}
@@ -133,7 +139,7 @@ public class JsonInboundMessageMapperTests {
UUID id = UUID.randomUUID();
String jsonMessage = "{\"payload\":\"myPayloadStuff\",\"headers\":{\"timestamp\":1,\"id\":\"" + id + "\",\"foo\":123,\"bar\":\"abc\"}}";
Message expected = MessageBuilder.withPayload("myPayloadStuff").setHeader("foo", 123).setHeader("bar", "abc").build();
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class, getParser());
Message> result = mapper.toMessage(jsonMessage);
assertThat(result, sameExceptImmutableHeaders(expected));
}
@@ -141,7 +147,7 @@ public class JsonInboundMessageMapperTests {
@Test
public void testToMessageInvalidFormatPayloadNoHeaders() throws Exception {
String jsonMessage = "{\"payload\":\"myPayloadStuff\"}";
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class, getParser());
try {
mapper.toMessage(jsonMessage);
fail();
@@ -155,7 +161,7 @@ public class JsonInboundMessageMapperTests {
public void testToMessageInvalidFormatHeadersNoPayload() throws Exception {
UUID id = UUID.randomUUID();
String jsonMessage = "{\"headers\":{\"$timestamp\":1,\"$id\":\"" + id + "\"}}";
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class, getParser());
try {
mapper.toMessage(jsonMessage);
fail();
@@ -169,7 +175,7 @@ public class JsonInboundMessageMapperTests {
public void testToMessageInvalidFormatHeadersAndStringPayloadWithMapToPayload() throws Exception {
UUID id = UUID.randomUUID();
String jsonMessage = "{\"headers\":{\"$timestamp\":1,\"$id\":\"" + id + "\"},\"payload\":\"myPayloadStuff\"}";
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class, getParser());
mapper.setMapToPayload(true);
try {
mapper.toMessage(jsonMessage);
@@ -185,7 +191,7 @@ public class JsonInboundMessageMapperTests {
TestBean bean = new TestBean();
UUID id = UUID.randomUUID();
String jsonMessage = "{\"headers\":{\"$timestamp\":1,\"$id\":\"" + id + "\"},\"payload\":" + getBeanAsJson(bean) + "}";
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(TestBean.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(TestBean.class, getParser());
mapper.setMapToPayload(true);
try {
mapper.toMessage(jsonMessage);
@@ -201,7 +207,7 @@ public class JsonInboundMessageMapperTests {
TestBean bean = new TestBean();
UUID id = UUID.randomUUID();
String jsonMessage = "{\"headers\":{\"$timestamp\":1,\"$id\":\"" + id + "\"},\"payload\":" + getBeanAsJson(bean) + "}";
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(Long.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(Long.class, getParser());
try {
mapper.toMessage(jsonMessage);
fail();
@@ -216,7 +222,7 @@ public class JsonInboundMessageMapperTests {
TestBean bean = new TestBean();
UUID id = UUID.randomUUID();
String jsonMessage = "{\"headers\":{\"$timestamp\":1,\"$id\":\"" + id + "\",\"myHeader\":" + getBeanAsJson(bean) + "},\"payload\":\"myPayloadStuff\"}";
- JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper mapper = new JsonInboundMessageMapper(String.class, getParser());
Map> headerTypes = new HashMap>();
headerTypes.put("myHeader", Long.class);
mapper.setHeaderTypes(headerTypes);
@@ -234,4 +240,5 @@ public class JsonInboundMessageMapperTests {
return mapper.toJson(bean);
}
+ protected abstract JsonMessageParser> getParser();
}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonSymmetricalMessageMappingTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonSymmetricalMessageMappingTests.java
similarity index 79%
rename from spring-integration-core/src/test/java/org/springframework/integration/json/JsonSymmetricalMessageMappingTests.java
rename to spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonSymmetricalMessageMappingTests.java
index f6e346cf88..23af36e283 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonSymmetricalMessageMappingTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/AbstractJsonSymmetricalMessageMappingTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2013 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.
@@ -21,17 +21,22 @@ import static org.junit.Assert.assertThat;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.junit.Test;
+
import org.springframework.integration.Message;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.message.MessageMatcher;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.context.NamedComponent;
+import org.springframework.integration.support.json.JsonInboundMessageMapper;
+import org.springframework.integration.support.json.JsonInboundMessageMapper.JsonMessageParser;
+import org.springframework.integration.support.json.JsonOutboundMessageMapper;
/**
* @author Jeremy Grelle
+ * @author Gary Russell
*/
-public class JsonSymmetricalMessageMappingTests {
+public abstract class AbstractJsonSymmetricalMessageMappingTests {
@Factory
public static Matcher> sameExceptImmutableHeaders(Message> operand) {
@@ -48,14 +53,14 @@ public class JsonSymmetricalMessageMappingTests {
String outboundJson = outboundMapper.fromMessage(testMessage);
- JsonInboundMessageMapper inboundMapper = new JsonInboundMessageMapper(String.class);
+ JsonInboundMessageMapper inboundMapper = new JsonInboundMessageMapper(String.class, getParser());
Message> result = inboundMapper.toMessage(outboundJson);
assertThat(result, sameExceptImmutableHeaders(testMessage));
-
- outboundJson = outboundMapper.fromMessage(result);
}
+ protected abstract JsonMessageParser> getParser();
+
private static class TestNamedComponent implements NamedComponent {
private final int id;
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/Jackson2JsonInboundMessageMapperTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/Jackson2JsonInboundMessageMapperTests.java
new file mode 100644
index 0000000000..dc6883b3f4
--- /dev/null
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/Jackson2JsonInboundMessageMapperTests.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2002-2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.json;
+
+import org.springframework.integration.support.json.Jackson2JsonMessageParser;
+import org.springframework.integration.support.json.JsonInboundMessageMapper.JsonMessageParser;
+
+/**
+ * @author Gary Russell
+ * @since 3.0
+ *
+ */
+public class Jackson2JsonInboundMessageMapperTests extends AbstractJsonInboundMessageMapperTests {
+
+ @Override
+ protected JsonMessageParser> getParser() {
+ return new Jackson2JsonMessageParser();
+ }
+
+}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/Jackson2JsonSymmetricalMessageMappingTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/Jackson2JsonSymmetricalMessageMappingTests.java
new file mode 100644
index 0000000000..440f876376
--- /dev/null
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/Jackson2JsonSymmetricalMessageMappingTests.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2002-2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.json;
+
+import org.springframework.integration.support.json.Jackson2JsonMessageParser;
+import org.springframework.integration.support.json.JsonInboundMessageMapper.JsonMessageParser;
+
+/**
+ * @author Gary Russell
+ * @since 3.0
+ *
+ */
+public class Jackson2JsonSymmetricalMessageMappingTests extends AbstractJsonSymmetricalMessageMappingTests {
+
+ @Override
+ protected JsonMessageParser> getParser() {
+ return new Jackson2JsonMessageParser();
+ }
+
+}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JacksonJsonInboundMessageMapperTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/JacksonJsonInboundMessageMapperTests.java
new file mode 100644
index 0000000000..0410589af0
--- /dev/null
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/JacksonJsonInboundMessageMapperTests.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2002-2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.json;
+
+import org.springframework.integration.support.json.JacksonJsonMessageParser;
+import org.springframework.integration.support.json.JsonInboundMessageMapper.JsonMessageParser;
+
+/**
+ * @author Gary Russell
+ * @since 3.0
+ *
+ */
+public class JacksonJsonInboundMessageMapperTests extends AbstractJsonInboundMessageMapperTests {
+
+ @Override
+ protected JsonMessageParser> getParser() {
+ return new JacksonJsonMessageParser();
+ }
+
+}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JacksonJsonSymmetricalMessageMappingTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/JacksonJsonSymmetricalMessageMappingTests.java
new file mode 100644
index 0000000000..7527fb6e1d
--- /dev/null
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/JacksonJsonSymmetricalMessageMappingTests.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2002-2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.json;
+
+import org.springframework.integration.support.json.JacksonJsonMessageParser;
+import org.springframework.integration.support.json.JsonInboundMessageMapper.JsonMessageParser;
+
+/**
+ * @author Gary Russell
+ * @since 3.0
+ *
+ */
+public class JacksonJsonSymmetricalMessageMappingTests extends AbstractJsonSymmetricalMessageMappingTests {
+
+ @Override
+ protected JsonMessageParser> getParser() {
+ return new JacksonJsonMessageParser();
+ }
+
+}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonOutboundMessageMapperTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonOutboundMessageMapperTests.java
index 908b9b6c73..b10f62b90d 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonOutboundMessageMapperTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonOutboundMessageMapperTests.java
@@ -29,9 +29,10 @@ import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.springframework.integration.Message;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.context.NamedComponent;
+import org.springframework.integration.support.json.JsonOutboundMessageMapper;
/**
* @author Jeremy Grelle
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonToObjectTransformerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonToObjectTransformerParserTests.java
index e282c0d3e9..e8bbc6c9b0 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonToObjectTransformerParserTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonToObjectTransformerParserTests.java
@@ -24,6 +24,7 @@ import org.codehaus.jackson.JsonParser.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.Message;
@@ -31,6 +32,9 @@ import org.springframework.integration.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.json.Jackson2JsonObjectMapper;
+import org.springframework.integration.support.json.JsonObjectMapper;
+import org.springframework.integration.support.json.JsonObjectMapperAdapter;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonToObjectTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonToObjectTransformerTests.java
index c7c865b388..9ae4a6771a 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/json/JsonToObjectTransformerTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/JsonToObjectTransformerTests.java
@@ -22,6 +22,8 @@ import org.codehaus.jackson.JsonParser.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
+import org.springframework.integration.support.json.JacksonJsonObjectMapper;
+
/**
* @author Mark Fisher
* @author Artem Bilan
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerParserTests.java
index 8752f4e1c1..31aa1f9ddd 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerParserTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerParserTests.java
@@ -28,6 +28,7 @@ import org.codehaus.jackson.JsonGenerator.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.Message;
@@ -35,6 +36,8 @@ import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageHeaders;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.json.Jackson2JsonObjectMapper;
+import org.springframework.integration.support.json.JsonObjectMapperAdapter;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerTests.java
index 6592c95a80..8d4a777f5f 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/json/ObjectToJsonTransformerTests.java
@@ -26,10 +26,12 @@ import java.util.regex.Pattern;
import org.codehaus.jackson.JsonGenerator.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
+
import org.springframework.integration.Message;
import org.springframework.integration.MessageHeaders;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.json.JacksonJsonObjectMapper;
/**
* @author Mark Fisher
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/test/util/TestUtils.java b/spring-integration-core/src/test/java/org/springframework/integration/test/util/TestUtils.java
index 659281a178..2aca8b709e 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/test/util/TestUtils.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/test/util/TestUtils.java
@@ -24,6 +24,7 @@ import java.util.Properties;
import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy;
import org.hamcrest.Matcher;
+
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.BeanFactory;
@@ -39,11 +40,11 @@ import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.channel.MessagePublishingErrorHandler;
import org.springframework.integration.context.IntegrationContextUtils;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.util.Assert;
import org.springframework.util.ErrorHandler;
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/util/BeanFactoryTypeConverterTests.java b/spring-integration-core/src/test/java/org/springframework/integration/util/BeanFactoryTypeConverterTests.java
index f589c3d2df..bc194b8bdb 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/util/BeanFactoryTypeConverterTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/util/BeanFactoryTypeConverterTests.java
@@ -46,6 +46,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
+
import org.springframework.beans.SimpleTypeConverter;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -56,11 +57,11 @@ import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.integration.Message;
import org.springframework.integration.MessageHeaders;
import org.springframework.integration.channel.QueueChannel;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
import org.springframework.integration.handler.ServiceActivatingHandler;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.message.GenericMessage;
+import org.springframework.integration.support.context.NamedComponent;
/**
* @author Oleg Zhurakousky
diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithSpelIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithSpelIntegrationTests.java
index 161822281b..183d9e5c65 100644
--- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithSpelIntegrationTests.java
+++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundGatewayWithSpelIntegrationTests.java
@@ -30,10 +30,10 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Assert;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.support.AbstractApplicationContext;
@@ -44,10 +44,11 @@ import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.core.PollableChannel;
import org.springframework.integration.jdbc.config.JdbcTypesEnum;
import org.springframework.integration.jdbc.storedproc.User;
-import org.springframework.integration.json.JsonInboundMessageMapper;
-import org.springframework.integration.json.JsonOutboundMessageMapper;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.json.Jackson2JsonMessageParser;
+import org.springframework.integration.support.json.JsonInboundMessageMapper;
+import org.springframework.integration.support.json.JsonOutboundMessageMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlReturnType;
import org.springframework.test.annotation.DirtiesContext;
@@ -159,7 +160,7 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
assertNotNull(resultMessage);
Object resultPayload = resultMessage.getPayload();
assertTrue(resultPayload instanceof String);
- Message> message = new JsonInboundMessageMapper(String.class).toMessage((String) resultPayload);
+ Message> message = new JsonInboundMessageMapper(String.class, new Jackson2JsonMessageParser()).toMessage((String) resultPayload);
assertEquals(testMessage.getPayload(), message.getPayload());
assertEquals(testMessage.getHeaders().get("FOO"), message.getHeaders().get("FOO"));
Mockito.verify(clobSqlReturnType).getTypeValue(Mockito.any(CallableStatement.class),
diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java
index 5096a85d79..889d1b3e68 100644
--- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java
+++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsMessageHistoryTests.java
@@ -32,11 +32,11 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.Message;
import org.springframework.integration.MessageHeaders;
import org.springframework.integration.MessagingException;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.core.PollableChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.jms.DefaultJmsHeaderMapper;
import org.springframework.integration.message.GenericMessage;
+import org.springframework.integration.support.context.NamedComponent;
/**
* @author Oleg Zhurakousky
diff --git a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java b/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java
index 73939b6527..3b177adb08 100644
--- a/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java
+++ b/spring-integration-rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java
@@ -21,9 +21,9 @@ import java.rmi.registry.Registry;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.gateway.MessagingGatewaySupport;
import org.springframework.integration.gateway.RequestReplyExchanger;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.remoting.rmi.RmiServiceExporter;
import org.springframework.remoting.support.RemoteInvocationExecutor;
import org.springframework.util.Assert;
diff --git a/spring-integration-security/src/main/java/org/springframework/integration/security/channel/ChannelSecurityMetadataSource.java b/spring-integration-security/src/main/java/org/springframework/integration/security/channel/ChannelSecurityMetadataSource.java
index 19dce5b64a..a9fcbe738b 100644
--- a/spring-integration-security/src/main/java/org/springframework/integration/security/channel/ChannelSecurityMetadataSource.java
+++ b/spring-integration-security/src/main/java/org/springframework/integration/security/channel/ChannelSecurityMetadataSource.java
@@ -26,7 +26,7 @@ import java.util.Set;
import java.util.regex.Pattern;
import org.springframework.integration.MessageChannel;
-import org.springframework.integration.context.NamedComponent;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityMetadataSource;
import org.springframework.util.Assert;
diff --git a/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java b/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java
index 9e9ebbc773..0f113a833a 100644
--- a/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java
+++ b/spring-integration-stream/src/test/java/org/springframework/integration/stream/config/ConsoleInboundChannelAdapterParserTests.java
@@ -34,9 +34,9 @@ import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.Message;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
+import org.springframework.integration.support.context.NamedComponent;
/**
* @author Mark Fisher
diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/util/TestUtils.java b/spring-integration-test/src/main/java/org/springframework/integration/test/util/TestUtils.java
index 659281a178..2aca8b709e 100644
--- a/spring-integration-test/src/main/java/org/springframework/integration/test/util/TestUtils.java
+++ b/spring-integration-test/src/main/java/org/springframework/integration/test/util/TestUtils.java
@@ -24,6 +24,7 @@ import java.util.Properties;
import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy;
import org.hamcrest.Matcher;
+
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.BeanFactory;
@@ -39,11 +40,11 @@ import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.channel.MessagePublishingErrorHandler;
import org.springframework.integration.context.IntegrationContextUtils;
-import org.springframework.integration.context.NamedComponent;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
+import org.springframework.integration.support.context.NamedComponent;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.util.Assert;
import org.springframework.util.ErrorHandler;