Skip to content

Commit 851b230

Browse files
author
Michael Wiles
committed
addressing code style removed comments and addressed review comments
1 parent 76e8ab1 commit 851b230

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

spring-integration-core/src/main/java/org/springframework/integration/config/DefaultConfiguringBeanFactoryPostProcessor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,11 @@ private void registerNullChannel() {
183183
.getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME);
184184
}
185185
}
186-
// don't think it will hurt to always find the parent
187186
if (beanFactory instanceof HierarchicalBeanFactory) {
188187
beanFactory = ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory();
189188
}
190-
// will definitely be found as containsBean returned true - but also want to be defensive in case of NPE
191-
} while (nullChannelDefinition == null && beanFactory != null); // not sure if beanFactroy not null is necessary
189+
}
190+
while (nullChannelDefinition == null);
192191

193192
if (nullChannelDefinition != null &&
194193
!NullChannel.class.getName().equals(nullChannelDefinition.getBeanClassName())) {

spring-integration-core/src/test/java/org/springframework/integration/configuration/EnableIntegrationTests.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
import org.springframework.integration.config.GlobalChannelInterceptor;
9191
import org.springframework.integration.config.IntegrationConverter;
9292
import org.springframework.integration.config.SpelFunctionFactoryBean;
93+
import org.springframework.integration.context.IntegrationContextUtils;
9394
import org.springframework.integration.core.MessageSource;
9495
import org.springframework.integration.core.MessagingTemplate;
9596
import org.springframework.integration.endpoint.AbstractEndpoint;
@@ -471,23 +472,31 @@ public void testMessagingGateway() throws InterruptedException {
471472
}
472473

473474
/**
474-
* Just creates an interim context to confirm that the DefaultConfiguringBeanFactoryPostProcessor
475-
* does not fail when there is an extra application context in the hierarchy.
475+
* Just creates an interim context to confirm that the
476+
* DefaultConfiguringBeanFactoryPostProcessor does not fail when there is an extra
477+
* application context in the hierarchy.
476478
*/
477479
@Test
478480
public void testDoubleParentChildAnnotationConfiguration() {
481+
482+
assertThat(this.context.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)).isTrue();
483+
479484
AnnotationConfigApplicationContext parent;
480485
parent = new AnnotationConfigApplicationContext();
481486
parent.register(ChildConfiguration.class);
482487
parent.setParent(this.context);
483488
parent.refresh();
484489

490+
assertThat(parent.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)).isFalse();
491+
485492
AnnotationConfigApplicationContext child;
486493
child = new AnnotationConfigApplicationContext();
487494
child.register(ChildConfiguration.class);
488495
child.setParent(parent);
489496
child.refresh();
490497

498+
assertThat(child.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)).isFalse();
499+
491500
parent.close();
492501
child.close();
493502
}

0 commit comments

Comments
 (0)