Make TestAotProcessor more easily extensible

This commit is contained in:
Sam Brannen
2022-10-26 14:20:46 +02:00
parent 997dd3ee65
commit 273e38c2b4

View File

@@ -79,16 +79,27 @@ public abstract class TestAotProcessor extends AbstractAotProcessor<Void> {
* 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<Class<?>> testClasses = scanner.scan();
Stream<Class<?>> 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<Class<?>> scanClasspathRoots() {
TestClassScanner scanner = new TestClassScanner(getClasspathRoots());
return scanner.scan();
}
}