|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2012-2019 the original author or authors. |
|
|
|
* Copyright 2012-2020 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -23,9 +23,9 @@ import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
import javax.validation.Configuration; |
|
|
|
import javax.validation.Configuration; |
|
|
|
import javax.validation.Validation; |
|
|
|
import javax.validation.Validation; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; |
|
|
|
import org.springframework.boot.context.event.ApplicationFailedEvent; |
|
|
|
import org.springframework.boot.context.event.ApplicationFailedEvent; |
|
|
|
import org.springframework.boot.context.event.ApplicationReadyEvent; |
|
|
|
import org.springframework.boot.context.event.ApplicationReadyEvent; |
|
|
|
import org.springframework.boot.context.event.ApplicationStartingEvent; |
|
|
|
|
|
|
|
import org.springframework.boot.context.event.SpringApplicationEvent; |
|
|
|
import org.springframework.boot.context.event.SpringApplicationEvent; |
|
|
|
import org.springframework.boot.context.logging.LoggingApplicationListener; |
|
|
|
import org.springframework.boot.context.logging.LoggingApplicationListener; |
|
|
|
import org.springframework.context.ApplicationListener; |
|
|
|
import org.springframework.context.ApplicationListener; |
|
|
|
@ -66,7 +66,7 @@ public class BackgroundPreinitializer implements ApplicationListener<SpringAppli |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onApplicationEvent(SpringApplicationEvent event) { |
|
|
|
public void onApplicationEvent(SpringApplicationEvent event) { |
|
|
|
if (!Boolean.getBoolean(IGNORE_BACKGROUNDPREINITIALIZER_PROPERTY_NAME) |
|
|
|
if (!Boolean.getBoolean(IGNORE_BACKGROUNDPREINITIALIZER_PROPERTY_NAME) |
|
|
|
&& event instanceof ApplicationStartingEvent && multipleProcessors() |
|
|
|
&& event instanceof ApplicationEnvironmentPreparedEvent && multipleProcessors() |
|
|
|
&& preinitializationStarted.compareAndSet(false, true)) { |
|
|
|
&& preinitializationStarted.compareAndSet(false, true)) { |
|
|
|
performPreinitialization(); |
|
|
|
performPreinitialization(); |
|
|
|
} |
|
|
|
} |
|
|
|
|