From 4c17b4c86545d836d7dbf4db7bd7425f07031485 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 10 May 2022 12:35:31 +0100 Subject: [PATCH] Switch BackgroundPreinitializer to implementing Ordered Closes gh-30905 --- .../boot/autoconfigure/BackgroundPreinitializer.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java index 4970937e88..fd134cc539 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java @@ -30,7 +30,7 @@ import org.springframework.boot.context.event.SpringApplicationEvent; import org.springframework.boot.context.logging.LoggingApplicationListener; import org.springframework.context.ApplicationListener; import org.springframework.core.NativeDetector; -import org.springframework.core.annotation.Order; +import org.springframework.core.Ordered; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; @@ -49,8 +49,7 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage * @author Sebastien Deleuze * @since 1.3.0 */ -@Order(LoggingApplicationListener.DEFAULT_ORDER + 1) -public class BackgroundPreinitializer implements ApplicationListener { +public class BackgroundPreinitializer implements ApplicationListener, Ordered { /** * System property that instructs Spring Boot how to run pre initialization. When the @@ -72,6 +71,11 @@ public class BackgroundPreinitializer implements ApplicationListener 1; } + @Override + public int getOrder() { + return LoggingApplicationListener.DEFAULT_ORDER + 1; + } + @Override public void onApplicationEvent(SpringApplicationEvent event) { if (!ENABLED) {