File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
spring-boot-actuator-autoconfigure/src
main/java/org/springframework/boot/actuate/autoconfigure/web/reactive
test/java/org/springframework/boot/actuate/autoconfigure/web/reactive
spring-boot/src/test/java/org/springframework/boot Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 1717package org .springframework .boot .actuate .autoconfigure .web .reactive ;
1818
1919import java .lang .reflect .Modifier ;
20- import java .util .ArrayList ;
21- import java .util .Arrays ;
22- import java .util .List ;
2320
2421import org .springframework .beans .FatalBeanException ;
2522import org .springframework .beans .factory .NoSuchBeanDefinitionException ;
3229import org .springframework .boot .web .reactive .server .ReactiveWebServerFactory ;
3330import org .springframework .context .ApplicationContext ;
3431import 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 }
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments