Skip to content

Commit 7ff2cb5

Browse files
committed
Polish
1 parent 3e9c2b8 commit 7ff2cb5

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextFactory.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
package org.springframework.boot.actuate.autoconfigure.web.reactive;
1818

1919
import java.lang.reflect.Modifier;
20-
import java.util.ArrayList;
21-
import java.util.Arrays;
22-
import java.util.List;
2320

2421
import org.springframework.beans.FatalBeanException;
2522
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
@@ -32,6 +29,7 @@
3229
import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory;
3330
import org.springframework.context.ApplicationContext;
3431
import org.springframework.context.ConfigurableApplicationContext;
32+
import org.springframework.util.ObjectUtils;
3533

3634
/**
3735
* A {@link ManagementContextFactory} for reactive web applications.
@@ -45,9 +43,9 @@ public ConfigurableApplicationContext createManagementContext(
4543
ApplicationContext parent, Class<?>... configClasses) {
4644
AnnotationConfigReactiveWebServerApplicationContext child = new AnnotationConfigReactiveWebServerApplicationContext();
4745
child.setParent(parent);
48-
List<Class<?>> combinedClasses = new ArrayList<>(Arrays.asList(configClasses));
49-
combinedClasses.add(ReactiveWebServerAutoConfiguration.class);
50-
child.register(combinedClasses.toArray(new Class<?>[combinedClasses.size()]));
46+
Class<?>[] combinedClasses = ObjectUtils.addObjectToArray(configClasses,
47+
ReactiveWebServerAutoConfiguration.class);
48+
child.register(combinedClasses);
5149
registerReactiveWebServerFactory(parent, child);
5250
return child;
5351
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextFactoryTests.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ public class ReactiveManagementContextFactoryTests {
4141
private AnnotationConfigReactiveWebServerApplicationContext parent = new AnnotationConfigReactiveWebServerApplicationContext();
4242

4343
@Test
44-
public void createManagementContextShouldCreateChildContextWithConfigClasses() throws Exception {
44+
public void createManagementContextShouldCreateChildContextWithConfigClasses()
45+
throws Exception {
4546
this.parent.register(ParentConfiguration.class);
4647
this.parent.refresh();
47-
AnnotationConfigReactiveWebServerApplicationContext childContext = (AnnotationConfigReactiveWebServerApplicationContext) this.factory.createManagementContext(this.parent,
48-
TestConfiguration1.class, TestConfiguration2.class);
48+
AnnotationConfigReactiveWebServerApplicationContext childContext = (AnnotationConfigReactiveWebServerApplicationContext) this.factory
49+
.createManagementContext(this.parent, TestConfiguration1.class,
50+
TestConfiguration2.class);
4951
childContext.refresh();
5052
assertThat(childContext.getBean(TestConfiguration1.class)).isNotNull();
5153
assertThat(childContext.getBean(TestConfiguration2.class)).isNotNull();
52-
assertThat(childContext.getBean(ReactiveWebServerAutoConfiguration.class)).isNotNull();
54+
assertThat(childContext.getBean(ReactiveWebServerAutoConfiguration.class))
55+
.isNotNull();
5356
}
5457

5558
@Configuration

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ public void defaultApplicationContextForReactiveWeb() {
410410
ExampleReactiveWebConfig.class);
411411
application.setWebApplicationType(WebApplicationType.REACTIVE);
412412
this.context = application.run();
413-
assertThat(this.context).isInstanceOf(
414-
AnnotationConfigReactiveWebServerApplicationContext.class);
413+
assertThat(this.context)
414+
.isInstanceOf(AnnotationConfigReactiveWebServerApplicationContext.class);
415415
}
416416

417417
@Test

0 commit comments

Comments
 (0)