From 6f8d4c77e6194f8e2b2262d4dc8c22835061c46a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 20 Jan 2016 22:23:57 +0000 Subject: [PATCH] Handle multiple ContextRefreshedEvents in BackgroundPreinitializer The same initializer will receive multiple ContextRefreshedEvents when their is an application context hierarchy. This commit updates the initializer to correctly handle multiple ContextRefreshedEvents and only act upon the first that it receives. See gh-4871 --- .../BackgroundPreinitializer.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java index 764c2fe9571..0b8bbab11a1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java @@ -53,7 +53,7 @@ public class BackgroundPreinitializer implements ApplicationListener