Switch BackgroundPreinitializer to implementing Ordered

Closes gh-30905
pull/30984/head
Andy Wilkinson 3 years ago
parent dbf0bcca63
commit 4c17b4c865

@ -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<SpringApplicationEvent> {
public class BackgroundPreinitializer implements ApplicationListener<SpringApplicationEvent>, Ordered {
/**
* System property that instructs Spring Boot how to run pre initialization. When the
@ -72,6 +71,11 @@ public class BackgroundPreinitializer implements ApplicationListener<SpringAppli
&& Runtime.getRuntime().availableProcessors() > 1;
}
@Override
public int getOrder() {
return LoggingApplicationListener.DEFAULT_ORDER + 1;
}
@Override
public void onApplicationEvent(SpringApplicationEvent event) {
if (!ENABLED) {

Loading…
Cancel
Save