Ignore BackgroundPreinitializer in native images

BackgroundPreinitializer is not relevant in native images so it is
better to ignore it automatically in order to reduce the footprint
in such environment.

See gh-22392
This commit is contained in:
Sébastien Deleuze 2020-07-17 14:57:14 +02:00 committed by Andy Wilkinson
parent 85828953bd
commit 66bf684eb6
1 changed files with 2 additions and 0 deletions

View File

@ -45,6 +45,7 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage
* @author Phillip Webb
* @author Andy Wilkinson
* @author Artsiom Yudovin
* @author Sebastien Deleuze
* @since 1.3.0
*/
@Order(LoggingApplicationListener.DEFAULT_ORDER + 1)
@ -67,6 +68,7 @@ public class BackgroundPreinitializer implements ApplicationListener<SpringAppli
static {
ENABLED = !Boolean.getBoolean(IGNORE_BACKGROUNDPREINITIALIZER_PROPERTY_NAME)
&& System.getProperty("org.graalvm.nativeimage.imagecode") == null
&& Runtime.getRuntime().availableProcessors() > 1;
}