Use AbstractAotProcessor.AOT_PROCESSING instead of duplicate constant

Closes gh-42461
This commit is contained in:
Stéphane Nicoll
2024-10-18 08:07:45 +02:00
parent 5806915155
commit b7979cf443
9 changed files with 18 additions and 9 deletions

View File

@@ -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) {

View File

@@ -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);
}
}

View File

@@ -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();