Skip to content

Commit b7979cf

Browse files
committed
Use AbstractAotProcessor.AOT_PROCESSING instead of duplicate constant
Closes gh-42461
1 parent 5806915 commit b7979cf

File tree

9 files changed

+18
-9
lines changed

9 files changed

+18
-9
lines changed

spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/DockerComposeLifecycleManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.springframework.boot.docker.compose.lifecycle.DockerComposeProperties.Stop;
3737
import org.springframework.context.ApplicationContext;
3838
import org.springframework.context.ApplicationListener;
39+
import org.springframework.context.aot.AbstractAotProcessor;
3940
import org.springframework.context.event.SimpleApplicationEventMulticaster;
4041
import org.springframework.core.log.LogMessage;
4142
import org.springframework.util.Assert;
@@ -95,7 +96,7 @@ class DockerComposeLifecycleManager {
9596
}
9697

9798
void start() {
98-
if (Boolean.getBoolean("spring.aot.processing") || AotDetector.useGeneratedArtifacts()) {
99+
if (Boolean.getBoolean(AbstractAotProcessor.AOT_PROCESSING) || AotDetector.useGeneratedArtifacts()) {
99100
logger.trace("Docker Compose support disabled with AOT and native images");
100101
return;
101102
}

spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/lifecycle/DockerComposeLifecycleManagerTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.springframework.boot.test.system.OutputCaptureExtension;
4545
import org.springframework.context.ApplicationContext;
4646
import org.springframework.context.ApplicationListener;
47+
import org.springframework.context.aot.AbstractAotProcessor;
4748
import org.springframework.context.support.GenericApplicationContext;
4849
import org.springframework.util.FileCopyUtils;
4950

@@ -126,7 +127,7 @@ void startWhenEnabledFalseDoesNotStart() {
126127

127128
@Test
128129
void startWhenAotProcessingDoesNotStart() {
129-
withSystemProperty("spring.aot.processing", "true", () -> {
130+
withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true", () -> {
130131
EventCapturingListener listener = new EventCapturingListener();
131132
this.eventListeners.add(listener);
132133
setUpRunningServices();

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleBeanPostProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
4141
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
4242
import org.springframework.context.ApplicationListener;
43+
import org.springframework.context.aot.AbstractAotProcessor;
4344
import org.springframework.core.Ordered;
4445
import org.springframework.core.annotation.Order;
4546
import org.springframework.core.log.LogMessage;
@@ -103,7 +104,7 @@ else if (this.startables.get() == Startables.STARTED) {
103104
}
104105

105106
private boolean isAotProcessingInProgress() {
106-
return Boolean.getBoolean("spring.aot.processing");
107+
return Boolean.getBoolean(AbstractAotProcessor.AOT_PROCESSING);
107108
}
108109

109110
private void initializeStartables(Startable startableBean, String startableBeanName) {

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionContextCustomizerFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
import org.testcontainers.containers.Container;
2525

2626
import org.springframework.boot.origin.Origin;
27+
import org.springframework.context.aot.AbstractAotProcessor;
2728
import org.springframework.core.annotation.MergedAnnotation;
2829
import org.springframework.core.annotation.MergedAnnotations;
2930
import org.springframework.test.context.ContextConfigurationAttributes;
@@ -96,7 +97,7 @@ private Object getFieldValue(Field field) {
9697
}
9798

9899
private boolean isAotProcessingInProgress() {
99-
return Boolean.getBoolean("spring.aot.processing");
100+
return Boolean.getBoolean(AbstractAotProcessor.AOT_PROCESSING);
100101
}
101102

102103
}

spring-boot-project/spring-boot-testcontainers/src/test/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleApplicationContextInitializerTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
3131
import org.springframework.context.annotation.Bean;
3232
import org.springframework.context.annotation.Configuration;
33+
import org.springframework.context.aot.AbstractAotProcessor;
3334
import org.springframework.core.env.MapPropertySource;
3435

3536
import static org.assertj.core.api.Assertions.assertThat;
@@ -149,7 +150,7 @@ void doesNotStartContainersWhenAotProcessingIsInProgress() {
149150
GenericContainer<?> container = mock(GenericContainer.class);
150151
AnnotationConfigApplicationContext applicationContext = createApplicationContext(container);
151152
then(container).shouldHaveNoInteractions();
152-
withSystemProperty("spring.aot.processing", "true",
153+
withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true",
153154
() -> applicationContext.refreshForAotProcessing(new RuntimeHints()));
154155
then(container).shouldHaveNoInteractions();
155156
applicationContext.close();

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringBootJoranConfigurator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution;
6161
import org.springframework.beans.factory.aot.BeanFactoryInitializationCode;
6262
import org.springframework.boot.logging.LoggingInitializationContext;
63+
import org.springframework.context.aot.AbstractAotProcessor;
6364
import org.springframework.core.CollectionFactory;
6465
import org.springframework.core.NativeDetector;
6566
import org.springframework.core.io.ByteArrayResource;
@@ -140,7 +141,7 @@ public void processModel(Model model) {
140141
}
141142

142143
private boolean isAotProcessingInProgress() {
143-
return Boolean.getBoolean("spring.aot.processing");
144+
return Boolean.getBoolean(AbstractAotProcessor.AOT_PROCESSING);
144145
}
145146

146147
static final class LogbackConfigurationAotContribution implements BeanFactoryInitializationAotContribution {

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationAotContributionTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.springframework.aot.test.generate.TestGenerationContext;
6060
import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution;
6161
import org.springframework.boot.logging.logback.SpringBootJoranConfigurator.LogbackConfigurationAotContribution;
62+
import org.springframework.context.aot.AbstractAotProcessor;
6263
import org.springframework.core.io.InputStreamSource;
6364

6465
import static org.assertj.core.api.Assertions.assertThat;
@@ -287,7 +288,7 @@ private void applyContribution(Model model, Consumer<LoggerContext> contextCusto
287288
contextCustomizer.accept(context);
288289
SpringBootJoranConfigurator configurator = new SpringBootJoranConfigurator(null);
289290
configurator.setContext(context);
290-
withSystemProperty("spring.aot.processing", "true", () -> configurator.processModel(model));
291+
withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true", () -> configurator.processModel(model));
291292
LogbackConfigurationAotContribution contribution = (LogbackConfigurationAotContribution) context
292293
.getObject(BeanFactoryInitializationAotContribution.class.getName());
293294
contribution.applyTo(generationContext, null);

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringBootJoranConfiguratorTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.springframework.boot.logging.LoggingInitializationContext;
3333
import org.springframework.boot.testsupport.system.CapturedOutput;
3434
import org.springframework.boot.testsupport.system.OutputCaptureExtension;
35+
import org.springframework.context.aot.AbstractAotProcessor;
3536
import org.springframework.mock.env.MockEnvironment;
3637
import org.springframework.test.context.support.TestPropertySourceUtils;
3738

@@ -221,7 +222,7 @@ void springPropertyInInclude() throws Exception {
221222

222223
@Test
223224
void addsAotContributionToContextDuringAotProcessing() throws Exception {
224-
withSystemProperty("spring.aot.processing", "true", () -> {
225+
withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true", () -> {
225226
initialize("property.xml");
226227
Object contribution = this.context.getObject(BeanFactoryInitializationAotContribution.class.getName());
227228
assertThat(contribution).isNotNull();

src/checkstyle/import-control.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<!-- Logging -->
7878
<subpackage name="logging">
7979
<allow pkg="org.springframework.boot.context.properties.bind" />
80+
<allow pkg="org.springframework.context.aot" />
8081
<disallow pkg="org.springframework.context" />
8182
<disallow pkg="org.springframework.boot.context" />
8283
</subpackage>

0 commit comments

Comments
 (0)