diff --git a/build.gradle b/build.gradle
index f80ff09403..ab7e08e8de 100644
--- a/build.gradle
+++ b/build.gradle
@@ -97,7 +97,6 @@ subprojects { subproject ->
servletApiVersion = '3.1.0'
smackVersion = '3.2.1'
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '1.3.0.M2'
- springBootVersion = '1.0.0.RC1'
springDataMongoVersion = '1.1.1.RELEASE'
springDataRedisVersion = '1.1.1.RELEASE'
springGemfireVersion = '1.3.1.RELEASE'
@@ -229,9 +228,6 @@ project('spring-integration-core') {
compile("com.jayway.jsonpath:json-path:$jsonpathVersion", optional)
testCompile ("org.aspectj:aspectjweaver:$aspectjVersion")
- testCompile ("org.springframework.boot:spring-boot-autoconfigure:$springBootVersion") {
- exclude group: 'org.springframework'
- }
}
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractPollingInboundChannelAdapterParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractPollingInboundChannelAdapterParser.java
index def09edd47..eb41144b46 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractPollingInboundChannelAdapterParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractPollingInboundChannelAdapterParser.java
@@ -20,6 +20,7 @@ import org.w3c.dom.Element;
import org.springframework.beans.BeanMetadataElement;
import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
@@ -45,9 +46,19 @@ public abstract class AbstractPollingInboundChannelAdapterParser extends Abstrac
BeanDefinitionBuilder adapterBuilder = BeanDefinitionBuilder
.genericBeanDefinition(SourcePollingChannelAdapterFactoryBean.class);
- String channelAdapterId = this.resolveId(element, adapterBuilder.getRawBeanDefinition(), parserContext);
- String sourceBeanName = channelAdapterId + ".source";
- parserContext.getRegistry().registerBeanDefinition(sourceBeanName, (BeanDefinition) source);
+ String sourceBeanName = null;
+
+ if (source instanceof BeanDefinition) {
+ String channelAdapterId = this.resolveId(element, adapterBuilder.getRawBeanDefinition(), parserContext);
+ sourceBeanName = channelAdapterId + ".source";
+ parserContext.getRegistry().registerBeanDefinition(sourceBeanName, (BeanDefinition) source);
+ }
+ else if (source instanceof RuntimeBeanReference) {
+ sourceBeanName = ((RuntimeBeanReference) source).getBeanName();
+ }
+ else {
+ parserContext.getReaderContext().error("Wrong 'source' type: must be 'BeanDefinition' or 'RuntimeBeanReference'", source);
+ }
adapterBuilder.addPropertyReference("source", sourceBeanName);
adapterBuilder.addPropertyReference("outputChannel", channelName);
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml
index 933963f608..7a275d23a7 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml
@@ -65,4 +65,12 @@
+
+
+
+
+
+
+
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java
index f4d4b70b1c..020d5a7c9c 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -34,6 +35,7 @@ import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.MessageDispatchingException;
import org.springframework.integration.channel.DirectChannel;
+import org.springframework.integration.core.MessageSource;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
@@ -294,6 +296,20 @@ public class ChannelAdapterParserTests {
}
}
+ @Test
+ public void testMessageSourceRef() {
+ PollableChannel channel = this.applicationContext.getBean("messageSourceRefChannel", PollableChannel.class);
+
+ Message> message = channel.receive(5000);
+ assertNotNull(message);
+ assertEquals("test", message.getPayload());
+
+ MessageSource> testMessageSource = this.applicationContext.getBean("testMessageSource", MessageSource.class);
+ SourcePollingChannelAdapter adapterWithMessageSourceRef = this.applicationContext.getBean("adapterWithMessageSourceRef", SourcePollingChannelAdapter.class);
+ MessageSource> source = TestUtils.getPropertyValue(adapterWithMessageSourceRef, "source", MessageSource.class);
+ assertSame(testMessageSource, source);
+ }
+
public static class SampleBean {
private final String message = "hello";
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/configuration/boot/IntegrationAutoConfigurationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/configuration/boot/IntegrationAutoConfigurationTests.java
deleted file mode 100644
index 478c94bd5e..0000000000
--- a/spring-integration-core/src/test/java/org/springframework/integration/configuration/boot/IntegrationAutoConfigurationTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2014 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.configuration.boot;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.integration.context.IntegrationContextUtils;
-
-/**
- * @author Artem Bilan
- * @since 4.0
- */
-public class IntegrationAutoConfigurationTests {
-
- @Test
- public void testIntegrationAutoConfiguration() {
- ConfigurableApplicationContext applicationContext = SpringApplication.run(Configuration.class);
- assertTrue(applicationContext.containsBean(IntegrationContextUtils.CHANNEL_INITIALIZER_BEAN_NAME));
- assertTrue(applicationContext.containsBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME));
- assertTrue(applicationContext.containsBean(IntegrationContextUtils.MESSAGING_ANNOTATION_POSTPROCESSOR_NAME));
- assertTrue(applicationContext.containsBean("jsonPath"));
- assertFalse(applicationContext.containsBean("xpath"));
- }
-
- @EnableAutoConfiguration
- public static class Configuration {
- }
-
-}