diff --git a/spring-integration-amqp/src/main/resources/org/springframework/integration/amqp/config/spring-integration-amqp-3.0.xsd b/spring-integration-amqp/src/main/resources/org/springframework/integration/amqp/config/spring-integration-amqp-3.0.xsd
index f07cf095f8..794e061d23 100644
--- a/spring-integration-amqp/src/main/resources/org/springframework/integration/amqp/config/spring-integration-amqp-3.0.xsd
+++ b/spring-integration-amqp/src/main/resources/org/springframework/integration/amqp/config/spring-integration-amqp-3.0.xsd
@@ -366,14 +366,6 @@
-
-
-
- Flag to indicate whether this Message Channel should start automatically.
- This only applies to a message-driven channel. Default is true.
-
-
-
@@ -566,13 +558,6 @@ standard headers to also be mapped.
-
-
-
-
-
@@ -722,15 +707,6 @@ standard headers to also be mapped.
-
-
-
-
- The lifeycle phase determining the start/stop order of the underlying listener container.
-
-
-
-
@@ -815,6 +791,7 @@ standard headers to also be mapped.
+
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelAdapterParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelAdapterParser.java
index 163579330c..dd54c51aac 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelAdapterParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelAdapterParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -18,8 +18,10 @@ package org.springframework.integration.config.xml;
import org.w3c.dom.Element;
+import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.config.TypedStringValue;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
@@ -30,7 +32,7 @@ import org.springframework.util.StringUtils;
/**
* Base parser for Channel Adapters.
- *
+ *
* Includes logic to determine {@link org.springframework.integration.MessageChannel}:
* if 'channel' attribute is defined - uses its value as 'channelName';
* if 'id' attribute is defined - creates {@link DirectChannel} at runtime and uses id's value as 'channelName';
@@ -63,7 +65,17 @@ public abstract class AbstractChannelAdapterParser extends AbstractBeanDefinitio
if (!StringUtils.hasText(channelName)) {
channelName = this.createDirectChannel(element, parserContext);
}
- return doParse(element, parserContext, channelName);
+ AbstractBeanDefinition beanDefinition = doParse(element, parserContext, channelName);
+ MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
+ String autoStartup = element.getAttribute(IntegrationNamespaceUtils.AUTO_STARTUP);
+ if (StringUtils.hasText(autoStartup)) {
+ propertyValues.add("autoStartup", new TypedStringValue(autoStartup));
+ }
+ String phase = element.getAttribute(IntegrationNamespaceUtils.PHASE);
+ if (StringUtils.hasText(phase)) {
+ propertyValues.add("phase", new TypedStringValue(phase));
+ }
+ return beanDefinition;
}
private String createDirectChannel(Element element, ParserContext parserContext) {
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractConsumerEndpointParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractConsumerEndpointParser.java
index 805a90bb24..7c3a8c414b 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractConsumerEndpointParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractConsumerEndpointParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -19,6 +19,8 @@ package org.springframework.integration.config.xml;
import java.util.Collection;
import java.util.List;
+import org.w3c.dom.Element;
+
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
@@ -34,7 +36,6 @@ import org.springframework.integration.config.ConsumerEndpointFactoryBean;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;
-import org.w3c.dom.Element;
/**
* Base class parser for elements that create Message Endpoints.
@@ -96,7 +97,8 @@ public abstract class AbstractConsumerEndpointParser extends AbstractBeanDefinit
+ elementDescription + ".", element);
}
return handlerBeanDefinition;
- } else {
+ }
+ else {
if (!hasInputChannelAttribute) {
String elementDescription = IntegrationNamespaceUtils.createElementDescription(element);
parserContext.getReaderContext().error("The '" + inputChannelAttributeName
@@ -115,18 +117,18 @@ public abstract class AbstractConsumerEndpointParser extends AbstractBeanDefinit
String inputChannelName = element.getAttribute(inputChannelAttributeName);
- if (!parserContext.getRegistry().containsBeanDefinition(inputChannelName)){
- if (parserContext.getRegistry().containsBeanDefinition(ChannelInitializer.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME)){
+ if (!parserContext.getRegistry().containsBeanDefinition(inputChannelName)) {
+ if (parserContext.getRegistry().containsBeanDefinition(ChannelInitializer.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME)) {
BeanDefinition channelRegistry = parserContext.getRegistry().
getBeanDefinition(ChannelInitializer.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME);
ConstructorArgumentValues caValues = channelRegistry.getConstructorArgumentValues();
ValueHolder vh = caValues.getArgumentValue(0, Collection.class);
- if (vh == null){ //although it should never happen if it does we can fix it
+ if (vh == null) { //although it should never happen if it does we can fix it
caValues.addIndexedArgumentValue(0, new ManagedSet());
}
@SuppressWarnings("unchecked")
- Collection channelCandidateNames = (Collection) caValues.getArgumentValue(0, Collection.class).getValue();
+ Collection channelCandidateNames = (Collection) caValues.getArgumentValue(0, Collection.class).getValue();
channelCandidateNames.add(inputChannelName);
}
else {
@@ -144,7 +146,8 @@ public abstract class AbstractConsumerEndpointParser extends AbstractBeanDefinit
}
IntegrationNamespaceUtils.configurePollerMetadata(pollerElementList.get(0), builder, parserContext);
}
- IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup");
+ IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IntegrationNamespaceUtils.AUTO_STARTUP);
+ IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IntegrationNamespaceUtils.PHASE);
AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
String beanName = this.resolveId(element, beanDefinition, parserContext);
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDefinition, beanName));
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractOutboundChannelAdapterParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractOutboundChannelAdapterParser.java
index 5f16c3738a..614bbf922c 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractOutboundChannelAdapterParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractOutboundChannelAdapterParser.java
@@ -71,8 +71,6 @@ public abstract class AbstractOutboundChannelAdapterParser extends AbstractChann
IntegrationNamespaceUtils.configurePollerMetadata(pollerElement, builder, parserContext);
}
builder.addPropertyValue("inputChannelName", channelName);
- IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup");
- IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "phase");
this.configureRequestHandlerAdviceChain(element, parserContext, handlerBeanComponentDefinition.getBeanDefinition(), builder);
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 6e6002a55b..7a672c9297 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
@@ -49,8 +49,6 @@ public abstract class AbstractPollingInboundChannelAdapterParser extends Abstrac
if (pollerElement != null) {
IntegrationNamespaceUtils.configurePollerMetadata(pollerElement, adapterBuilder, parserContext);
}
- IntegrationNamespaceUtils.setValueIfAttributeDefined(adapterBuilder, element, "auto-startup");
- IntegrationNamespaceUtils.setValueIfAttributeDefined(adapterBuilder, element, "phase");
return adapterBuilder.getBeanDefinition();
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ChainParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ChainParser.java
index 63788d145e..b179a94db4 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ChainParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ChainParser.java
@@ -99,8 +99,6 @@ public class ChainParser extends AbstractConsumerEndpointParser {
}
builder.addPropertyValue("handlers", handlerList);
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "send-timeout");
- IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup");
- IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "phase");
return builder;
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java
index 160e2a3564..4d98b70048 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java
@@ -65,6 +65,8 @@ public abstract class IntegrationNamespaceUtils {
static final String EXPRESSION_ATTRIBUTE = "expression";
public static final String HANDLER_ALIAS_SUFFIX = ".handler";
public static final String REQUEST_HANDLER_ADVICE_CHAIN = "request-handler-advice-chain";
+ public static final String AUTO_STARTUP = "auto-startup";
+ public static final String PHASE = "phase";
/**
* Property name on ChannelInitializer used to configure the default max subscribers for
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 e52c4d393b..3d891ceb2b 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
@@ -22,7 +22,7 @@ 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.context.Lifecycle;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageHandlingException;
@@ -66,7 +66,7 @@ import org.springframework.util.Assert;
* @author Gary Russell
* @author Artem Bilan
*/
-public class MessageHandlerChain extends AbstractMessageHandler implements MessageProducer, SmartLifecycle {
+public class MessageHandlerChain extends AbstractMessageHandler implements MessageProducer, Lifecycle {
private volatile List handlers;
@@ -85,10 +85,6 @@ public class MessageHandlerChain extends AbstractMessageHandler implements Messa
private final Object initializationMonitor = new Object();
- private volatile boolean autoStartup = true;
-
- private volatile int phase = Integer.MAX_VALUE;
-
private volatile boolean running;
private final ReentrantLock lifecycleLock = new ReentrantLock();
@@ -176,14 +172,6 @@ public class MessageHandlerChain extends AbstractMessageHandler implements Messa
* SmartLifecycle implementation (delegates to the {@link #handlers})
*/
- public final boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- public final int getPhase() {
- return this.phase;
- }
-
public final boolean isRunning() {
this.lifecycleLock.lock();
try {
@@ -237,26 +225,18 @@ public class MessageHandlerChain extends AbstractMessageHandler implements Messa
}
}
- public void setAutoStartup(boolean autoStartup) {
- this.autoStartup = autoStartup;
- }
-
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
private void doStop() {
for (MessageHandler handler : this.handlers) {
- if (handler instanceof SmartLifecycle) {
- ((SmartLifecycle) handler).stop();
+ if (handler instanceof Lifecycle) {
+ ((Lifecycle) handler).stop();
}
}
}
private void doStart() {
for (MessageHandler handler : this.handlers) {
- if (handler instanceof SmartLifecycle) {
- ((SmartLifecycle) handler).start();
+ if (handler instanceof Lifecycle) {
+ ((Lifecycle) handler).start();
}
}
}
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 7ea44de1ea..8d8eb42dca 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
@@ -877,13 +877,6 @@
-
-
-
- Lifecycle attribute signaling if this component should be started during Application Context startup.
-
-
-
@@ -907,6 +900,7 @@
+
@@ -1041,23 +1035,7 @@
-
-
-
- Lifecycle attribute signaling if this component should be started during Application Context startup.
-
-
-
-
-
-
-
- The Lifecycle attribute determining the start/stop order
- of the underlying MessageHandlerChain.
-
-
-
-
+
@@ -1552,16 +1530,6 @@
-
-
-
-
- The Lifecycle attribute determining the start/stop order
- of the underlying MessageHandlerChain.
-
-
-
-
@@ -3066,17 +3034,6 @@
-->
-
-
-
- Lifecycle attribute signaling if this component should be
- started during Application Context startup. Defaults to true.
-
-
-
-
-
-
@@ -3099,6 +3056,7 @@
]]>
+