Merge branch '2.4.x'

Closes gh-25304
pull/25314/head
Andy Wilkinson 4 years ago
commit 9628df87ff

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,6 +29,7 @@ import org.springframework.boot.context.event.ApplicationReadyEvent;
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.format.support.DefaultFormattingConversionService;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
@ -67,8 +68,7 @@ public class BackgroundPreinitializer implements ApplicationListener<SpringAppli
private static final boolean ENABLED;
static {
ENABLED = !Boolean.getBoolean(IGNORE_BACKGROUNDPREINITIALIZER_PROPERTY_NAME)
&& System.getProperty("org.graalvm.nativeimage.imagecode") == null
ENABLED = !Boolean.getBoolean(IGNORE_BACKGROUNDPREINITIALIZER_PROPERTY_NAME) && !NativeDetector.inNativeImage()
&& Runtime.getRuntime().availableProcessors() > 1;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -71,6 +71,7 @@ import org.springframework.boot.web.server.WebServer;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.NativeDetector;
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@ -110,8 +111,6 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
*/
public static final String DEFAULT_PROTOCOL = "org.apache.coyote.http11.Http11NioProtocol";
private static final boolean IN_NATIVE_IMAGE = System.getProperty("org.graalvm.nativeimage.imagecode") != null;
private File baseDirectory;
private List<Valve> engineValves = new ArrayList<>();
@ -169,7 +168,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
private static List<LifecycleListener> getDefaultLifecycleListeners() {
ArrayList<LifecycleListener> lifecycleListeners = new ArrayList<>();
if (!IN_NATIVE_IMAGE) {
if (!NativeDetector.inNativeImage()) {
AprLifecycleListener aprLifecycleListener = new AprLifecycleListener();
if (AprLifecycleListener.isAprAvailable()) {
lifecycleListeners.add(aprLifecycleListener);

Loading…
Cancel
Save