Register hints for @TestPropertySource factory

This commit updates MergedContextConfigurationRuntimeHints so that it
registers hints for a custom PropertySourceFactory.

Closes gh-31160
This commit is contained in:
Sam Brannen
2023-09-03 16:53:53 +02:00
parent 7882d265c6
commit e8fd29091c
7 changed files with 52 additions and 7 deletions

View File

@@ -76,6 +76,12 @@ class MergedContextConfigurationRuntimeHints {
for (PropertySourceDescriptor descriptor : mergedConfig.getPropertySourceDescriptors()) {
// @TestPropertySource(locations = ...)
registerClasspathResources(descriptor.locations().stream(), runtimeHints, classLoader);
// @TestPropertySource(factory = ...)
Class<?> factoryClass = descriptor.propertySourceFactory();
if (factoryClass != null) {
registerDeclaredConstructors(factoryClass, runtimeHints);
}
}
// @WebAppConfiguration(value = ...)