Use AbstractAotProcessor.AOT_PROCESSING instead of duplicate constant
Closes gh-42461
This commit is contained in:
parent
5806915155
commit
b7979cf443
@ -36,6 +36,7 @@ import org.springframework.boot.docker.compose.lifecycle.DockerComposeProperties
|
||||
import org.springframework.boot.docker.compose.lifecycle.DockerComposeProperties.Stop;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.aot.AbstractAotProcessor;
|
||||
import org.springframework.context.event.SimpleApplicationEventMulticaster;
|
||||
import org.springframework.core.log.LogMessage;
|
||||
import org.springframework.util.Assert;
|
||||
@ -95,7 +96,7 @@ class DockerComposeLifecycleManager {
|
||||
}
|
||||
|
||||
void start() {
|
||||
if (Boolean.getBoolean("spring.aot.processing") || AotDetector.useGeneratedArtifacts()) {
|
||||
if (Boolean.getBoolean(AbstractAotProcessor.AOT_PROCESSING) || AotDetector.useGeneratedArtifacts()) {
|
||||
logger.trace("Docker Compose support disabled with AOT and native images");
|
||||
return;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ import org.springframework.boot.test.system.CapturedOutput;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.aot.AbstractAotProcessor;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
@ -126,7 +127,7 @@ class DockerComposeLifecycleManagerTests {
|
||||
|
||||
@Test
|
||||
void startWhenAotProcessingDoesNotStart() {
|
||||
withSystemProperty("spring.aot.processing", "true", () -> {
|
||||
withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true", () -> {
|
||||
EventCapturingListener listener = new EventCapturingListener();
|
||||
this.eventListeners.add(listener);
|
||||
setUpRunningServices();
|
||||
|
@ -40,6 +40,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.aot.AbstractAotProcessor;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.log.LogMessage;
|
||||
@ -103,7 +104,7 @@ class TestcontainersLifecycleBeanPostProcessor
|
||||
}
|
||||
|
||||
private boolean isAotProcessingInProgress() {
|
||||
return Boolean.getBoolean("spring.aot.processing");
|
||||
return Boolean.getBoolean(AbstractAotProcessor.AOT_PROCESSING);
|
||||
}
|
||||
|
||||
private void initializeStartables(Startable startableBean, String startableBeanName) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 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.
|
||||
@ -24,6 +24,7 @@ import java.util.List;
|
||||
import org.testcontainers.containers.Container;
|
||||
|
||||
import org.springframework.boot.origin.Origin;
|
||||
import org.springframework.context.aot.AbstractAotProcessor;
|
||||
import org.springframework.core.annotation.MergedAnnotation;
|
||||
import org.springframework.core.annotation.MergedAnnotations;
|
||||
import org.springframework.test.context.ContextConfigurationAttributes;
|
||||
@ -96,7 +97,7 @@ class ServiceConnectionContextCustomizerFactory implements ContextCustomizerFact
|
||||
}
|
||||
|
||||
private boolean isAotProcessingInProgress() {
|
||||
return Boolean.getBoolean("spring.aot.processing");
|
||||
return Boolean.getBoolean(AbstractAotProcessor.AOT_PROCESSING);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import org.springframework.beans.factory.support.AbstractBeanFactory;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.aot.AbstractAotProcessor;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -149,7 +150,7 @@ class TestcontainersLifecycleApplicationContextInitializerTests {
|
||||
GenericContainer<?> container = mock(GenericContainer.class);
|
||||
AnnotationConfigApplicationContext applicationContext = createApplicationContext(container);
|
||||
then(container).shouldHaveNoInteractions();
|
||||
withSystemProperty("spring.aot.processing", "true",
|
||||
withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true",
|
||||
() -> applicationContext.refreshForAotProcessing(new RuntimeHints()));
|
||||
then(container).shouldHaveNoInteractions();
|
||||
applicationContext.close();
|
||||
|
@ -60,6 +60,7 @@ import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution;
|
||||
import org.springframework.beans.factory.aot.BeanFactoryInitializationCode;
|
||||
import org.springframework.boot.logging.LoggingInitializationContext;
|
||||
import org.springframework.context.aot.AbstractAotProcessor;
|
||||
import org.springframework.core.CollectionFactory;
|
||||
import org.springframework.core.NativeDetector;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
@ -140,7 +141,7 @@ class SpringBootJoranConfigurator extends JoranConfigurator {
|
||||
}
|
||||
|
||||
private boolean isAotProcessingInProgress() {
|
||||
return Boolean.getBoolean("spring.aot.processing");
|
||||
return Boolean.getBoolean(AbstractAotProcessor.AOT_PROCESSING);
|
||||
}
|
||||
|
||||
static final class LogbackConfigurationAotContribution implements BeanFactoryInitializationAotContribution {
|
||||
|
@ -59,6 +59,7 @@ import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
||||
import org.springframework.aot.test.generate.TestGenerationContext;
|
||||
import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution;
|
||||
import org.springframework.boot.logging.logback.SpringBootJoranConfigurator.LogbackConfigurationAotContribution;
|
||||
import org.springframework.context.aot.AbstractAotProcessor;
|
||||
import org.springframework.core.io.InputStreamSource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -287,7 +288,7 @@ class LogbackConfigurationAotContributionTests {
|
||||
contextCustomizer.accept(context);
|
||||
SpringBootJoranConfigurator configurator = new SpringBootJoranConfigurator(null);
|
||||
configurator.setContext(context);
|
||||
withSystemProperty("spring.aot.processing", "true", () -> configurator.processModel(model));
|
||||
withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true", () -> configurator.processModel(model));
|
||||
LogbackConfigurationAotContribution contribution = (LogbackConfigurationAotContribution) context
|
||||
.getObject(BeanFactoryInitializationAotContribution.class.getName());
|
||||
contribution.applyTo(generationContext, null);
|
||||
|
@ -32,6 +32,7 @@ import org.springframework.boot.context.properties.source.ConfigurationPropertyS
|
||||
import org.springframework.boot.logging.LoggingInitializationContext;
|
||||
import org.springframework.boot.testsupport.system.CapturedOutput;
|
||||
import org.springframework.boot.testsupport.system.OutputCaptureExtension;
|
||||
import org.springframework.context.aot.AbstractAotProcessor;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
import org.springframework.test.context.support.TestPropertySourceUtils;
|
||||
|
||||
@ -221,7 +222,7 @@ class SpringBootJoranConfiguratorTests {
|
||||
|
||||
@Test
|
||||
void addsAotContributionToContextDuringAotProcessing() throws Exception {
|
||||
withSystemProperty("spring.aot.processing", "true", () -> {
|
||||
withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true", () -> {
|
||||
initialize("property.xml");
|
||||
Object contribution = this.context.getObject(BeanFactoryInitializationAotContribution.class.getName());
|
||||
assertThat(contribution).isNotNull();
|
||||
|
@ -77,6 +77,7 @@
|
||||
<!-- Logging -->
|
||||
<subpackage name="logging">
|
||||
<allow pkg="org.springframework.boot.context.properties.bind" />
|
||||
<allow pkg="org.springframework.context.aot" />
|
||||
<disallow pkg="org.springframework.context" />
|
||||
<disallow pkg="org.springframework.boot.context" />
|
||||
</subpackage>
|
||||
|
Loading…
x
Reference in New Issue
Block a user