From 273e38c2b4ff53b4dbe472b961739cb9fd7081b2 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 26 Oct 2022 14:20:46 +0200 Subject: [PATCH] Make TestAotProcessor more easily extensible --- .../test/context/aot/TestAotProcessor.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/TestAotProcessor.java b/spring-test/src/main/java/org/springframework/test/context/aot/TestAotProcessor.java index 44ab970dca..bfa1665fa2 100644 --- a/spring-test/src/main/java/org/springframework/test/context/aot/TestAotProcessor.java +++ b/spring-test/src/main/java/org/springframework/test/context/aot/TestAotProcessor.java @@ -79,16 +79,27 @@ public abstract class TestAotProcessor extends AbstractAotProcessor { * output directories. In addition, run-time hints are registered for the * application contexts used by the test classes as well as test infrastructure * components used by the tests. + * @see #scanClasspathRoots() + * @see #createFileSystemGeneratedFiles() + * @see TestContextAotGenerator#processAheadOfTime(Stream) + * @see #writeHints(org.springframework.aot.hint.RuntimeHints) */ protected void performAotProcessing() { - TestClassScanner scanner = new TestClassScanner(getClasspathRoots()); - Stream> testClasses = scanner.scan(); - + Stream> testClasses = scanClasspathRoots(); GeneratedFiles generatedFiles = createFileSystemGeneratedFiles(); TestContextAotGenerator generator = new TestContextAotGenerator(generatedFiles); generator.processAheadOfTime(testClasses); - writeHints(generator.getRuntimeHints()); } + /** + * Scan the configured {@linkplain #getClasspathRoots() classpath roots} for + * Spring integration test classes. + * @return a stream of Spring integration test classes + */ + protected Stream> scanClasspathRoots() { + TestClassScanner scanner = new TestClassScanner(getClasspathRoots()); + return scanner.scan(); + } + }