diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java index 72bd09926e..b88f715d83 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java @@ -30,7 +30,7 @@ public class GlobalChannelInterceptorWrapper implements ChannelInterceptor, Orde private final ChannelInterceptor channelInterceptor; - private volatile String[] patterns; + private volatile String[] patterns = new String[]{"*"}; // default private volatile int order = 0; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/GlobalChannelInterceptorParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/GlobalChannelInterceptorParser.java index 7cab301a78..14fe3a4fa6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/GlobalChannelInterceptorParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/GlobalChannelInterceptorParser.java @@ -54,7 +54,6 @@ public class GlobalChannelInterceptorParser extends AbstractBeanDefinitionParser protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { this.createAndRegisterGlobalPostProcessorIfNecessary(parserContext); - String channelPattern = element.getAttribute(CHANNEL_NAME_PATTERN_ATTRIBUTE); BeanDefinitionBuilder globalChannelInterceptorBuilder = BeanDefinitionBuilder.genericBeanDefinition(BASE_PACKAGE + "GlobalChannelInterceptorWrapper"); BeanComponentDefinition interceptorBeanDefinition = IntegrationNamespaceUtils.parseInnerHandlerDefinition(element, parserContext); @@ -66,12 +65,8 @@ public class GlobalChannelInterceptorParser extends AbstractBeanDefinitionParser globalChannelInterceptorBuilder.addConstructorArgValue(new RuntimeBeanReference(beanName)); } IntegrationNamespaceUtils.setValueIfAttributeDefined(globalChannelInterceptorBuilder, element, "order"); - if (StringUtils.hasText(channelPattern)) { - globalChannelInterceptorBuilder.addPropertyValue("patterns", channelPattern); - } - else { - globalChannelInterceptorBuilder.addPropertyValue("patterns", new String[] {"*"}); - } + IntegrationNamespaceUtils.setValueIfAttributeDefined(globalChannelInterceptorBuilder, element, CHANNEL_NAME_PATTERN_ATTRIBUTE, "patterns"); + String beanName = BeanDefinitionReaderUtils.generateBeanName( globalChannelInterceptorBuilder.getBeanDefinition(), parserContext.getRegistry()); parserContext.registerBeanComponent(new BeanComponentDefinition(globalChannelInterceptorBuilder.getBeanDefinition(), beanName));