Ensure MergedContextConfigurationRuntimeHints is invoked once per config

This commit is contained in:
Sam Brannen 2022-10-09 15:16:42 +02:00
parent d4a5565340
commit cfa95c793b
1 changed files with 2 additions and 1 deletions

View File

@ -123,7 +123,6 @@ public class TestContextAotGenerator {
mergedConfigMappings.add(mergedConfig, testClass);
this.testRuntimeHintsRegistrars.forEach(registrar ->
registrar.registerHints(this.runtimeHints, testClass, classLoader));
this.mergedConfigRuntimeHints.registerHints(this.runtimeHints, mergedConfig, classLoader);
});
MultiValueMap<ClassName, Class<?>> initializerClassMappings = processAheadOfTime(mergedConfigMappings);
@ -141,10 +140,12 @@ public class TestContextAotGenerator {
}
private MultiValueMap<ClassName, Class<?>> processAheadOfTime(MultiValueMap<MergedContextConfiguration, Class<?>> mergedConfigMappings) {
ClassLoader classLoader = getClass().getClassLoader();
MultiValueMap<ClassName, Class<?>> initializerClassMappings = new LinkedMultiValueMap<>();
mergedConfigMappings.forEach((mergedConfig, testClasses) -> {
logger.debug(LogMessage.format("Generating AOT artifacts for test classes %s",
testClasses.stream().map(Class::getName).toList()));
this.mergedConfigRuntimeHints.registerHints(this.runtimeHints, mergedConfig, classLoader);
try {
// Use first test class discovered for a given unique MergedContextConfiguration.
Class<?> testClass = testClasses.get(0);