Skip to content

Commit fb3ecba

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

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
* @author Oleg Zhurakousky
8686
* @author Artem Bilan
8787
* @author Gary Russell
88+
* @author Michael Wiles
8889
*
8990
* @see IntegrationContextUtils
9091
*/
@@ -183,12 +184,11 @@ private void registerNullChannel() {
183184
.getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME);
184185
}
185186
}
186-
// don't think it will hurt to always find the parent
187187
if (beanFactory instanceof HierarchicalBeanFactory) {
188188
beanFactory = ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory();
189189
}
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
190+
}
191+
while (nullChannelDefinition == null);
192192

193193
if (nullChannelDefinition != null &&
194194
!NullChannel.class.getName().equals(nullChannelDefinition.getBeanClassName())) {

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

Lines changed: 13 additions & 3 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;
@@ -136,6 +137,7 @@
136137
/**
137138
* @author Artem Bilan
138139
* @author Gary Russell
140+
* @author Michael Wiles
139141
*
140142
* @since 4.0
141143
*/
@@ -471,27 +473,35 @@ public void testMessagingGateway() throws InterruptedException {
471473
}
472474

473475
/**
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.
476+
* Just creates an interim context to confirm that the
477+
* DefaultConfiguringBeanFactoryPostProcessor does not fail when there is an extra
478+
* application context in the hierarchy.
476479
*/
477480
@Test
478481
public void testDoubleParentChildAnnotationConfiguration() {
482+
483+
assertThat(this.context.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)).isTrue();
484+
479485
AnnotationConfigApplicationContext parent;
480486
parent = new AnnotationConfigApplicationContext();
481487
parent.register(ChildConfiguration.class);
482488
parent.setParent(this.context);
483489
parent.refresh();
484490

491+
assertThat(parent.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)).isFalse();
492+
485493
AnnotationConfigApplicationContext child;
486494
child = new AnnotationConfigApplicationContext();
487495
child.register(ChildConfiguration.class);
488496
child.setParent(parent);
489497
child.refresh();
490498

499+
assertThat(child.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)).isFalse();
500+
491501
parent.close();
492502
child.close();
493503
}
494-
504+
495505
@Test
496506
public void testParentChildAnnotationConfiguration() {
497507
AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext();

0 commit comments

Comments
 (0)