|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2020 the original author or authors. |
| 2 | + * Copyright 2012-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
71 | 71 | import org.springframework.boot.web.servlet.ServletContextInitializer;
|
72 | 72 | import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
|
73 | 73 | import org.springframework.context.ResourceLoaderAware;
|
| 74 | +import org.springframework.core.NativeDetector; |
74 | 75 | import org.springframework.core.io.ResourceLoader;
|
75 | 76 | import org.springframework.util.Assert;
|
76 | 77 | import org.springframework.util.ClassUtils;
|
@@ -110,8 +111,6 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
|
110 | 111 | */
|
111 | 112 | public static final String DEFAULT_PROTOCOL = "org.apache.coyote.http11.Http11NioProtocol";
|
112 | 113 |
|
113 |
| - private static final boolean IN_NATIVE_IMAGE = System.getProperty("org.graalvm.nativeimage.imagecode") != null; |
114 |
| - |
115 | 114 | private File baseDirectory;
|
116 | 115 |
|
117 | 116 | private List<Valve> engineValves = new ArrayList<>();
|
@@ -169,7 +168,7 @@ public TomcatServletWebServerFactory(String contextPath, int port) {
|
169 | 168 |
|
170 | 169 | private static List<LifecycleListener> getDefaultLifecycleListeners() {
|
171 | 170 | ArrayList<LifecycleListener> lifecycleListeners = new ArrayList<>();
|
172 |
| - if (!IN_NATIVE_IMAGE) { |
| 171 | + if (!NativeDetector.inNativeImage()) { |
173 | 172 | AprLifecycleListener aprLifecycleListener = new AprLifecycleListener();
|
174 | 173 | if (AprLifecycleListener.isAprAvailable()) {
|
175 | 174 | lifecycleListeners.add(aprLifecycleListener);
|
|
0 commit comments