forked from spring-projects/spring-integration
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INT-2434-v3 polished based on @garyrussell last comments
- Loading branch information
Showing
3 changed files
with
24 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -16,13 +16,13 @@ | ||
|
|
||
package org.springframework.integration.config.xml; | package org.springframework.integration.config.xml; | ||
|
|
||
import java.util.HashSet; | import java.util.Collection; | ||
import java.util.List; | import java.util.List; | ||
import java.util.Set; | |||
|
|
||
import org.w3c.dom.Element; | import org.w3c.dom.Element; | ||
|
|
||
import org.springframework.beans.factory.config.BeanDefinition; | import org.springframework.beans.factory.config.BeanDefinition; | ||
import org.springframework.beans.factory.config.ConstructorArgumentValues; | |||
import org.springframework.beans.factory.parsing.BeanComponentDefinition; | import org.springframework.beans.factory.parsing.BeanComponentDefinition; | ||
import org.springframework.beans.factory.support.AbstractBeanDefinition; | import org.springframework.beans.factory.support.AbstractBeanDefinition; | ||
import org.springframework.beans.factory.support.BeanDefinitionBuilder; | import org.springframework.beans.factory.support.BeanDefinitionBuilder; | ||
|
@@ -93,14 +93,12 @@ protected final AbstractBeanDefinition parseInternal(Element element, ParserCont | ||
|
|
||
if (!parserContext.getRegistry().containsBeanDefinition(inputChannelName)){ | if (!parserContext.getRegistry().containsBeanDefinition(inputChannelName)){ | ||
BeanDefinition channelRegistry = parserContext.getRegistry().getBeanDefinition(ChannelInitializer.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME); | BeanDefinition channelRegistry = parserContext.getRegistry().getBeanDefinition(ChannelInitializer.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME); | ||
|
ConstructorArgumentValues caValues = channelRegistry.getConstructorArgumentValues(); | ||
@SuppressWarnings("unchecked") | if (caValues != null){ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
olegz
Author
Owner
|
|||
Set<String> channelNames = (Set<String>) channelRegistry.getAttribute(ChannelInitializer.CHANNEL_NAMES_ATTR); | @SuppressWarnings("unchecked") | ||
if (channelNames == null){ | Collection<String> channelCandidateNames = (Collection<String>) caValues.getArgumentValue(0, Collection.class).getValue(); | ||
channelNames = (Set<String>) new HashSet<String>(); | channelCandidateNames.add(inputChannelName); | ||
channelRegistry.setAttribute(ChannelInitializer.CHANNEL_NAMES_ATTR, channelNames); | |||
} | } | ||
channelNames.add(inputChannelName); | |||
} | } | ||
|
|
||
builder.addPropertyValue("inputChannelName", inputChannelName); | builder.addPropertyValue("inputChannelName", inputChannelName); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Should never happen, but I wonder if we should log rather than just silently ignore?