Source:
<code>public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { Map<String, Object> annotationAttributes = importingClassMetadata.getAnnotationAttributes(EnablePublisher.class.getName()); if (annotationAttributes == null) { return; } String value = (String) annotationAttributes.get("value"); if (!registry.containsBeanDefinition(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME)) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(PublisherAnnotationBeanPostProcessor.class) .setRole(BeanDefinition.ROLE_INFRASTRUCTURE); if (StringUtils.hasText(value)) { builder.addPropertyReference("defaultChannel", value); } registry.registerBeanDefinition(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME, builder.getBeanDefinition()); } else { BeanDefinition beanDefinition = registry.getBeanDefinition(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME); MutablePropertyValues propertyValues = beanDefinition.getPropertyValues(); RuntimeBeanReference defaultChannel = (RuntimeBeanReference) propertyValues.getPropertyValue("defaultChannel").getValue(); if (StringUtils.hasText(value)) { if (defaultChannel == null) { propertyValues.addPropertyValue("defaultChannel", new RuntimeBeanReference(value)); } else if (!value.equals(defaultChannel.getBeanName())) { throw new BeanDefinitionStoreException("When more than one enable publisher definition " + "(@EnablePublisher or <annotation-config>)" + " is found in the context, they all must have the same 'default-publisher-channel' value."); } } } <START> } <END></code><technical_language>(in places), emit a DEBUG INFO log setting publisher default output channel 'foo'. import some @Configuration sets unexpected default (where expect error if @Publish a channel is found</technical_language>

Target:
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { Map<String, Object> annotationAttributes = importingClassMetadata.getAnnotationAttributes(EnablePublisher.class.getName()); if (annotationAttributes == null) { return; } String value = (String) annotationAttributes.get("value"); if (!registry.containsBeanDefinition(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME)) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(PublisherAnnotationBeanPostProcessor.class) .setRole(BeanDefinition.ROLE_INFRASTRUCTURE); if (StringUtils.hasText(value)) { builder.addPropertyReference("defaultChannel", value); if (logger.isInfoEnabled()) { logger.info("Setting '@Publisher' default-output-channel to '" + value + "'."); } } registry.registerBeanDefinition(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME, builder.getBeanDefinition()); } else { BeanDefinition beanDefinition = registry.getBeanDefinition(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME); MutablePropertyValues propertyValues = beanDefinition.getPropertyValues(); RuntimeBeanReference defaultChannel = (RuntimeBeanReference) propertyValues.getPropertyValue("defaultChannel").getValue(); if (StringUtils.hasText(value)) { if (defaultChannel == null) { propertyValues.addPropertyValue("defaultChannel", new RuntimeBeanReference(value)); if (logger.isInfoEnabled()) { logger.info("Setting '@Publisher' default-output-channel to '" + value + "'."); } } else if (!value.equals(defaultChannel.getBeanName())) { throw new BeanDefinitionStoreException("When more than one enable publisher definition " + "(@EnablePublisher or <annotation-config>)" + " is found in the context, they all must have the same 'default-publisher-channel' value."); } } } }