diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 1b18f95643..d557d8dd89 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -394,7 +394,6 @@ public class SpringApplication { } private void refreshContext(ConfigurableApplicationContext context) { - refresh((ApplicationContext) context); if (this.registerShutdownHook) { try { context.registerShutdownHook(); @@ -403,6 +402,7 @@ public class SpringApplication { // Not allowed in some environments. } } + refresh((ApplicationContext) context); } private void configureHeadlessProperty() {