@@ -365,16 +365,13 @@ private ConfigurableEnvironment prepareEnvironment(SpringApplicationRunListeners
365
365
}
366
366
367
367
private Class <? extends ConfigurableEnvironment > deduceEnvironmentClass () {
368
+ WebApplicationType webApplicationType = this .properties .getWebApplicationType ();
368
369
Class <? extends ConfigurableEnvironment > environmentType = this .applicationContextFactory
369
- .getEnvironmentType (this . properties . getWebApplicationType () );
370
+ .getEnvironmentType (webApplicationType );
370
371
if (environmentType == null && this .applicationContextFactory != ApplicationContextFactory .DEFAULT ) {
371
- environmentType = ApplicationContextFactory .DEFAULT
372
- .getEnvironmentType (this .properties .getWebApplicationType ());
372
+ environmentType = ApplicationContextFactory .DEFAULT .getEnvironmentType (webApplicationType );
373
373
}
374
- if (environmentType == null ) {
375
- return ApplicationEnvironment .class ;
376
- }
377
- return environmentType ;
374
+ return (environmentType != null ) ? environmentType : ApplicationEnvironment .class ;
378
375
}
379
376
380
377
private void prepareContext (DefaultBootstrapContext bootstrapContext , ConfigurableApplicationContext context ,
@@ -473,10 +470,10 @@ private ConfigurableEnvironment getOrCreateEnvironment() {
473
470
if (this .environment != null ) {
474
471
return this .environment ;
475
472
}
476
- ConfigurableEnvironment environment = this .applicationContextFactory
477
- . createEnvironment ( this .properties . getWebApplicationType () );
473
+ WebApplicationType webApplicationType = this .properties . getWebApplicationType ();
474
+ ConfigurableEnvironment environment = this .applicationContextFactory . createEnvironment ( webApplicationType );
478
475
if (environment == null && this .applicationContextFactory != ApplicationContextFactory .DEFAULT ) {
479
- environment = ApplicationContextFactory .DEFAULT .createEnvironment (this . properties . getWebApplicationType () );
476
+ environment = ApplicationContextFactory .DEFAULT .createEnvironment (webApplicationType );
480
477
}
481
478
return (environment != null ) ? environment : new ApplicationEnvironment ();
482
479
}
0 commit comments