Expose a system property when AOT processing is running

This commit exposes a "spring.aot.processing" system property when the
AOT engine is running. This can be used by code that need to react
differently when the application is being refreshed for AOT processing.

Closes gh-29340
This commit is contained in:
Stephane Nicoll
2022-10-18 16:57:47 +02:00
parent 004875670b
commit 82a0154bd1
4 changed files with 59 additions and 9 deletions

View File

@@ -36,7 +36,7 @@ import org.springframework.context.aot.AbstractAotProcessor;
* @see TestContextAotGenerator
* @see org.springframework.context.aot.ContextAotProcessor
*/
public abstract class TestAotProcessor extends AbstractAotProcessor {
public abstract class TestAotProcessor extends AbstractAotProcessor<Void> {
private final Set<Path> classpathRoots;
@@ -66,9 +66,11 @@ public abstract class TestAotProcessor extends AbstractAotProcessor {
* {@linkplain #deleteExistingOutput() clearing output directories} first and
* then {@linkplain #performAotProcessing() performing AOT processing}.
*/
public void process() {
@Override
protected Void doProcess() {
deleteExistingOutput();
performAotProcessing();
return null;
}
/**