From a78782b594b4c663a8ac5c0888e293b5a98bdfab Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 17 Oct 2011 11:47:04 -0400 Subject: [PATCH 1/2] INT-1813 added support for recognizig default components Added support for recognizing default components in parent ApplicationContext before they get auto-registered in child AC INT-1813 polishing added containtBean check earlier, removed 'IfNecessary' from method names --- ...ltConfiguringBeanFactoryPostProcessor.java | 111 +++++++++--------- ...figuringBeanFactoryPostProcessorTests.java | 28 ++++- .../config/xml/childApplicationContext.xml | 24 ++++ .../config/xml/parentApplicationContext.xml | 9 ++ .../xml/superParentApplicationContext.xml | 12 ++ 5 files changed, 123 insertions(+), 61 deletions(-) create mode 100644 spring-integration-core/src/test/java/org/springframework/integration/config/xml/childApplicationContext.xml create mode 100644 spring-integration-core/src/test/java/org/springframework/integration/config/xml/parentApplicationContext.xml create mode 100644 spring-integration-core/src/test/java/org/springframework/integration/config/xml/superParentApplicationContext.xml diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessor.java index c8ee98bdfd..cdd1ed5395 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessor.java @@ -20,7 +20,6 @@ import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; @@ -51,11 +50,16 @@ class DefaultConfiguringBeanFactoryPostProcessor implements BeanFactoryPostProce public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + if (beanFactory instanceof BeanDefinitionRegistry) { BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; this.registerNullChannel(registry); - this.registerErrorChannelIfNecessary(registry); - this.registerTaskSchedulerIfNecessary(registry); + if (!beanFactory.containsBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)){ + this.registerErrorChannel(registry); + } + if (!beanFactory.containsBean(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)){ + this.registerTaskScheduler(registry); + } this.registerIdGeneratorConfigurer(registry); } else if (logger.isWarnEnabled()) { @@ -89,9 +93,9 @@ class DefaultConfiguringBeanFactoryPostProcessor implements BeanFactoryPostProce * {@link IntegrationContextUtils#NULL_CHANNEL_BEAN_NAME}. */ private void registerNullChannel(BeanDefinitionRegistry registry) { - if (registry.isBeanNameInUse(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { - BeanDefinition bDef = registry.getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); - if (bDef.getBeanClassName().equals(NullChannel.class.getName())) { + if (registry.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)){ + BeanDefinition nullChannelDefinition = registry.getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); + if (nullChannelDefinition.getBeanClassName().equals(equals(NullChannel.class.getName()))){ return; } else { @@ -109,63 +113,56 @@ class DefaultConfiguringBeanFactoryPostProcessor implements BeanFactoryPostProce } /** - * Register an error channel in the given BeanDefinitionRegistry if not yet present. The bean name for which this is - * checking is defined by the constant {@link IntegrationContextUtils#ERROR_CHANNEL_BEAN_NAME}. + * Register an error channel in the given BeanDefinitionRegistry. */ - private void registerErrorChannelIfNecessary(BeanDefinitionRegistry registry) { - if (!registry.isBeanNameInUse(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)) { - if (logger.isInfoEnabled()) { - logger - .info("No bean named '" - + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME - + "' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created."); - } - RootBeanDefinition errorChannelDef = new RootBeanDefinition(); - errorChannelDef.setBeanClassName(IntegrationNamespaceUtils.BASE_PACKAGE - + ".channel.PublishSubscribeChannel"); - BeanDefinitionHolder errorChannelHolder = new BeanDefinitionHolder(errorChannelDef, - IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); - BeanDefinitionReaderUtils.registerBeanDefinition(errorChannelHolder, registry); - BeanDefinitionBuilder loggingHandlerBuilder = BeanDefinitionBuilder - .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".handler.LoggingHandler"); - loggingHandlerBuilder.addConstructorArgValue("ERROR"); - BeanDefinitionBuilder loggingEndpointBuilder = BeanDefinitionBuilder - .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".endpoint.EventDrivenConsumer"); - loggingEndpointBuilder.addConstructorArgReference(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); - loggingEndpointBuilder.addConstructorArgValue(loggingHandlerBuilder.getBeanDefinition()); - BeanComponentDefinition componentDefinition = new BeanComponentDefinition(loggingEndpointBuilder - .getBeanDefinition(), ERROR_LOGGER_BEAN_NAME); - BeanDefinitionReaderUtils.registerBeanDefinition(componentDefinition, registry); + private void registerErrorChannel(BeanDefinitionRegistry registry) { + if (logger.isInfoEnabled()) { + logger + .info("No bean named '" + + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME + + "' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created."); } + RootBeanDefinition errorChannelDef = new RootBeanDefinition(); + errorChannelDef.setBeanClassName(IntegrationNamespaceUtils.BASE_PACKAGE + + ".channel.PublishSubscribeChannel"); + BeanDefinitionHolder errorChannelHolder = new BeanDefinitionHolder(errorChannelDef, + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); + BeanDefinitionReaderUtils.registerBeanDefinition(errorChannelHolder, registry); + BeanDefinitionBuilder loggingHandlerBuilder = BeanDefinitionBuilder + .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".handler.LoggingHandler"); + loggingHandlerBuilder.addConstructorArgValue("ERROR"); + BeanDefinitionBuilder loggingEndpointBuilder = BeanDefinitionBuilder + .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".endpoint.EventDrivenConsumer"); + loggingEndpointBuilder.addConstructorArgReference(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); + loggingEndpointBuilder.addConstructorArgValue(loggingHandlerBuilder.getBeanDefinition()); + BeanComponentDefinition componentDefinition = new BeanComponentDefinition(loggingEndpointBuilder + .getBeanDefinition(), ERROR_LOGGER_BEAN_NAME); + BeanDefinitionReaderUtils.registerBeanDefinition(componentDefinition, registry); } /** - * Register a TaskScheduler in the given BeanDefinitionRegistry if not yet present. The bean name for which this is - * checking is defined by the constant {@link IntegrationContextUtils#TASK_SCHEDULER_BEAN_NAME}. + * Register a TaskScheduler in the given BeanDefinitionRegistry. */ - private void registerTaskSchedulerIfNecessary(BeanDefinitionRegistry registry) { - if (!registry.isBeanNameInUse(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)) { - if (logger.isInfoEnabled()) { - logger - .info("No bean named '" - + IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME - + "' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created."); - } - BeanDefinitionBuilder schedulerBuilder = BeanDefinitionBuilder - .genericBeanDefinition("org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler"); - schedulerBuilder.addPropertyValue("poolSize", 10); - schedulerBuilder.addPropertyValue("threadNamePrefix", "task-scheduler-"); - schedulerBuilder.addPropertyValue("rejectedExecutionHandler", new CallerRunsPolicy()); - BeanDefinitionBuilder errorHandlerBuilder = BeanDefinitionBuilder - .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE - + ".channel.MessagePublishingErrorHandler"); - errorHandlerBuilder.addPropertyReference("defaultErrorChannel", - IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); - schedulerBuilder.addPropertyValue("errorHandler", errorHandlerBuilder.getBeanDefinition()); - BeanComponentDefinition schedulerComponent = new BeanComponentDefinition(schedulerBuilder - .getBeanDefinition(), IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME); - BeanDefinitionReaderUtils.registerBeanDefinition(schedulerComponent, registry); + private void registerTaskScheduler(BeanDefinitionRegistry registry) { + if (logger.isInfoEnabled()) { + logger + .info("No bean named '" + + IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME + + "' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created."); } + BeanDefinitionBuilder schedulerBuilder = BeanDefinitionBuilder + .genericBeanDefinition("org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler"); + schedulerBuilder.addPropertyValue("poolSize", 10); + schedulerBuilder.addPropertyValue("threadNamePrefix", "task-scheduler-"); + schedulerBuilder.addPropertyValue("rejectedExecutionHandler", new CallerRunsPolicy()); + BeanDefinitionBuilder errorHandlerBuilder = BeanDefinitionBuilder + .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + + ".channel.MessagePublishingErrorHandler"); + errorHandlerBuilder.addPropertyReference("defaultErrorChannel", + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); + schedulerBuilder.addPropertyValue("errorHandler", errorHandlerBuilder.getBeanDefinition()); + BeanComponentDefinition schedulerComponent = new BeanComponentDefinition(schedulerBuilder + .getBeanDefinition(), IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME); + BeanDefinitionReaderUtils.registerBeanDefinition(schedulerComponent, registry); } - } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessorTests.java index 764d5f0f0b..74d1ebd7cf 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2011 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. @@ -16,25 +16,29 @@ package org.springframework.integration.config.xml; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import java.util.Arrays; import org.junit.Test; import org.junit.runner.RunWith; - import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.channel.MessagePublishingErrorHandler; import org.springframework.integration.channel.NullChannel; import org.springframework.integration.channel.PublishSubscribeChannel; import org.springframework.integration.context.IntegrationContextUtils; +import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + /** * @author Mark Fisher + * @author Oleg Zhurakousky */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration @@ -67,5 +71,21 @@ public class DefaultConfiguringBeanFactoryPostProcessorTests { Object defaultErrorChannel = new DirectFieldAccessor(errorHandler).getPropertyValue("defaultErrorChannel"); assertEquals(context.getBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME), defaultErrorChannel); } + + @Test + public void taskSchedulerNotRegisteredMoreThanOnce() { + ClassPathXmlApplicationContext superParentApplicationContext = new ClassPathXmlApplicationContext("superParentApplicationContext.xml", this.getClass()); + ClassPathXmlApplicationContext parentApplicationContext = + new ClassPathXmlApplicationContext(new String[]{"org/springframework/integration/config/xml/parentApplicationContext.xml"}, superParentApplicationContext); + ClassPathXmlApplicationContext childApplicationContext = + new ClassPathXmlApplicationContext(new String[]{"org/springframework/integration/config/xml/childApplicationContext.xml"}, parentApplicationContext); + System.out.println(Arrays.asList(childApplicationContext.getBeanDefinitionNames())); + TaskScheduler parentScheduler = childApplicationContext.getParent().getBean("taskScheduler", TaskScheduler.class); + TaskScheduler childScheduler = childApplicationContext.getBean("taskScheduler", TaskScheduler.class); + + assertNotNull("Child task scheduler was null", childScheduler); + assertNotNull("Parent task scheduler was null", parentScheduler); + assertEquals("Different schedulers in parent and child", parentScheduler, childScheduler ); + } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/childApplicationContext.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/childApplicationContext.xml new file mode 100644 index 0000000000..0078147aa2 --- /dev/null +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/childApplicationContext.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/parentApplicationContext.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/parentApplicationContext.xml new file mode 100644 index 0000000000..2c31c66eb8 --- /dev/null +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/parentApplicationContext.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/superParentApplicationContext.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/superParentApplicationContext.xml new file mode 100644 index 0000000000..7fb0e656e9 --- /dev/null +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/superParentApplicationContext.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file From 3a1a1096cee8ba6f6066ac764df6e2370ba4d578 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Tue, 18 Oct 2011 18:08:22 -0400 Subject: [PATCH 2/2] polishing --- ...ltConfiguringBeanFactoryPostProcessor.java | 51 +++++++++---------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessor.java index cdd1ed5395..b23c6e0b88 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/DefaultConfiguringBeanFactoryPostProcessor.java @@ -20,6 +20,7 @@ import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; @@ -50,14 +51,13 @@ class DefaultConfiguringBeanFactoryPostProcessor implements BeanFactoryPostProce public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - if (beanFactory instanceof BeanDefinitionRegistry) { BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; this.registerNullChannel(registry); - if (!beanFactory.containsBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)){ + if (!beanFactory.containsBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)) { this.registerErrorChannel(registry); } - if (!beanFactory.containsBean(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)){ + if (!beanFactory.containsBean(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)) { this.registerTaskScheduler(registry); } this.registerIdGeneratorConfigurer(registry); @@ -93,9 +93,9 @@ class DefaultConfiguringBeanFactoryPostProcessor implements BeanFactoryPostProce * {@link IntegrationContextUtils#NULL_CHANNEL_BEAN_NAME}. */ private void registerNullChannel(BeanDefinitionRegistry registry) { - if (registry.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)){ + if (registry.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { BeanDefinition nullChannelDefinition = registry.getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); - if (nullChannelDefinition.getBeanClassName().equals(equals(NullChannel.class.getName()))){ + if (NullChannel.class.getName().equals(nullChannelDefinition.getBeanClassName())) { return; } else { @@ -117,10 +117,8 @@ class DefaultConfiguringBeanFactoryPostProcessor implements BeanFactoryPostProce */ private void registerErrorChannel(BeanDefinitionRegistry registry) { if (logger.isInfoEnabled()) { - logger - .info("No bean named '" - + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME - + "' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created."); + logger.info("No bean named '" + IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME + + "' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created."); } RootBeanDefinition errorChannelDef = new RootBeanDefinition(); errorChannelDef.setBeanClassName(IntegrationNamespaceUtils.BASE_PACKAGE @@ -128,15 +126,15 @@ class DefaultConfiguringBeanFactoryPostProcessor implements BeanFactoryPostProce BeanDefinitionHolder errorChannelHolder = new BeanDefinitionHolder(errorChannelDef, IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); BeanDefinitionReaderUtils.registerBeanDefinition(errorChannelHolder, registry); - BeanDefinitionBuilder loggingHandlerBuilder = BeanDefinitionBuilder - .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".handler.LoggingHandler"); + BeanDefinitionBuilder loggingHandlerBuilder = BeanDefinitionBuilder.genericBeanDefinition( + IntegrationNamespaceUtils.BASE_PACKAGE + ".handler.LoggingHandler"); loggingHandlerBuilder.addConstructorArgValue("ERROR"); - BeanDefinitionBuilder loggingEndpointBuilder = BeanDefinitionBuilder - .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".endpoint.EventDrivenConsumer"); + BeanDefinitionBuilder loggingEndpointBuilder = BeanDefinitionBuilder.genericBeanDefinition( + IntegrationNamespaceUtils.BASE_PACKAGE + ".endpoint.EventDrivenConsumer"); loggingEndpointBuilder.addConstructorArgReference(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); loggingEndpointBuilder.addConstructorArgValue(loggingHandlerBuilder.getBeanDefinition()); - BeanComponentDefinition componentDefinition = new BeanComponentDefinition(loggingEndpointBuilder - .getBeanDefinition(), ERROR_LOGGER_BEAN_NAME); + BeanComponentDefinition componentDefinition = new BeanComponentDefinition( + loggingEndpointBuilder.getBeanDefinition(), ERROR_LOGGER_BEAN_NAME); BeanDefinitionReaderUtils.registerBeanDefinition(componentDefinition, registry); } @@ -145,24 +143,21 @@ class DefaultConfiguringBeanFactoryPostProcessor implements BeanFactoryPostProce */ private void registerTaskScheduler(BeanDefinitionRegistry registry) { if (logger.isInfoEnabled()) { - logger - .info("No bean named '" - + IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME - + "' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created."); + logger.info("No bean named '" + IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME + + "' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created."); } - BeanDefinitionBuilder schedulerBuilder = BeanDefinitionBuilder - .genericBeanDefinition("org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler"); + BeanDefinitionBuilder schedulerBuilder = BeanDefinitionBuilder.genericBeanDefinition( + "org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler"); schedulerBuilder.addPropertyValue("poolSize", 10); schedulerBuilder.addPropertyValue("threadNamePrefix", "task-scheduler-"); schedulerBuilder.addPropertyValue("rejectedExecutionHandler", new CallerRunsPolicy()); - BeanDefinitionBuilder errorHandlerBuilder = BeanDefinitionBuilder - .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE - + ".channel.MessagePublishingErrorHandler"); - errorHandlerBuilder.addPropertyReference("defaultErrorChannel", - IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); + BeanDefinitionBuilder errorHandlerBuilder = BeanDefinitionBuilder.genericBeanDefinition( + IntegrationNamespaceUtils.BASE_PACKAGE + ".channel.MessagePublishingErrorHandler"); + errorHandlerBuilder.addPropertyReference("defaultErrorChannel", IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); schedulerBuilder.addPropertyValue("errorHandler", errorHandlerBuilder.getBeanDefinition()); - BeanComponentDefinition schedulerComponent = new BeanComponentDefinition(schedulerBuilder - .getBeanDefinition(), IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME); + BeanComponentDefinition schedulerComponent = new BeanComponentDefinition( + schedulerBuilder.getBeanDefinition(), IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME); BeanDefinitionReaderUtils.registerBeanDefinition(schedulerComponent, registry); } + }