use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-integration by spring-projects.
the class ControlBusParser method parseHandler.
@Override
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition("org.springframework.integration.config.ExpressionControlBusFactoryBean");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "bean-resolver");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "send-timeout");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "order");
return builder;
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-integration by spring-projects.
the class PublishingInterceptorParser method parseInternal.
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
BeanDefinitionBuilder rootBuilder = BeanDefinitionBuilder.genericBeanDefinition(MessagePublishingInterceptor.class);
BeanDefinitionBuilder spelSourceBuilder = BeanDefinitionBuilder.genericBeanDefinition(MethodNameMappingPublisherMetadataSource.class);
Map<String, Map<?, ?>> mappings = this.getMappings(element, element.getAttribute("default-channel"), parserContext);
spelSourceBuilder.addConstructorArgValue(mappings.get("payload"));
if (mappings.get("headers") != null) {
spelSourceBuilder.addPropertyValue("headerExpressionMap", mappings.get("headers"));
}
BeanDefinitionBuilder chResolverBuilder = BeanDefinitionBuilder.genericBeanDefinition(BeanFactoryChannelResolver.class);
if (mappings.get("channels") != null) {
spelSourceBuilder.addPropertyValue("channelMap", mappings.get("channels"));
}
String chResolverName = BeanDefinitionReaderUtils.registerWithGeneratedName(chResolverBuilder.getBeanDefinition(), parserContext.getRegistry());
String defaultChannel = StringUtils.hasText(element.getAttribute("default-channel")) ? element.getAttribute("default-channel") : IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME;
rootBuilder.addConstructorArgValue(spelSourceBuilder.getBeanDefinition());
rootBuilder.addPropertyReference("channelResolver", chResolverName);
rootBuilder.addPropertyValue("defaultChannelName", defaultChannel);
return rootBuilder.getBeanDefinition();
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-integration by spring-projects.
the class ResequencerParser method parseHandler.
@Override
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ResequencingMessageHandler.class);
BeanDefinitionBuilder processorBuilder = BeanDefinitionBuilder.genericBeanDefinition(ResequencingMessageGroupProcessor.class);
builder.addConstructorArgValue(processorBuilder.getBeanDefinition());
this.doParse(builder, element, processorBuilder.getBeanDefinition(), parserContext);
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, RELEASE_PARTIAL_SEQUENCES_ATTRIBUTE);
return builder;
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-integration by spring-projects.
the class DefaultConfiguringBeanFactoryPostProcessor method registerErrorChannel.
/**
* Register an error channel in the given BeanDefinitionRegistry.
*/
private void registerErrorChannel(BeanDefinitionRegistry registry) {
if (this.logger.isInfoEnabled()) {
this.logger.info("No bean named '" + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME + "' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.");
}
registry.registerBeanDefinition(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME, new RootBeanDefinition(PublishSubscribeChannel.class));
BeanDefinition loggingHandler = BeanDefinitionBuilder.genericBeanDefinition(LoggingHandler.class).addConstructorArgValue("ERROR").getBeanDefinition();
String errorLoggerBeanName = ERROR_LOGGER_BEAN_NAME + IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX;
registry.registerBeanDefinition(errorLoggerBeanName, loggingHandler);
BeanDefinitionBuilder loggingEndpointBuilder = BeanDefinitionBuilder.genericBeanDefinition(ConsumerEndpointFactoryBean.class).addPropertyReference("handler", errorLoggerBeanName).addPropertyValue("inputChannelName", IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME);
BeanComponentDefinition componentDefinition = new BeanComponentDefinition(loggingEndpointBuilder.getBeanDefinition(), ERROR_LOGGER_BEAN_NAME);
BeanDefinitionReaderUtils.registerBeanDefinition(componentDefinition, registry);
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-integration by spring-projects.
the class IntegrationConfigUtils method autoCreateDirectChannel.
public static void autoCreateDirectChannel(String channelName, BeanDefinitionRegistry registry) {
BeanDefinitionBuilder channelBuilder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);
BeanDefinitionHolder holder = new BeanDefinitionHolder(channelBuilder.getBeanDefinition(), channelName);
BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry);
}
Aggregations