Skip to content

Commit eb60cf4

Browse files
committed
Remove duplication of BindableRuntimeHintsRegistrarTests
There were several tests in CPBFIAPT that were duplicating tests in BindableRuntimeHintsRegistrarTests. To test the AOT processor, all that is really necessary is to assert that the expected types are found and passed to BindableRuntimeHintsRegistrar. The tests for BindableRuntimeHintsRegistrar are then responsible for asserting that the expected hints are generated for the various different types. Closes gh-35645
1 parent f03f062 commit eb60cf4

File tree

2 files changed

+26
-585
lines changed

2 files changed

+26
-585
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanFactoryInitializationAotProcessor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
class ConfigurationPropertiesBeanFactoryInitializationAotProcessor implements BeanFactoryInitializationAotProcessor {
4141

4242
@Override
43-
public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
43+
public ConfigurationPropertiesReflectionHintsContribution processAheadOfTime(
44+
ConfigurableListableBeanFactory beanFactory) {
4445
String[] beanNames = beanFactory.getBeanNamesForAnnotation(ConfigurationProperties.class);
4546
List<Class<?>> types = new ArrayList<>();
4647
for (String beanName : beanNames) {
@@ -55,7 +56,7 @@ public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableL
5556
return null;
5657
}
5758

58-
private static final class ConfigurationPropertiesReflectionHintsContribution
59+
static final class ConfigurationPropertiesReflectionHintsContribution
5960
implements BeanFactoryInitializationAotContribution {
6061

6162
private final Iterable<Class<?>> types;
@@ -70,6 +71,10 @@ public void applyTo(GenerationContext generationContext,
7071
BindableRuntimeHintsRegistrar.forTypes(this.types).registerHints(generationContext.getRuntimeHints());
7172
}
7273

74+
Iterable<Class<?>> getTypes() {
75+
return this.types;
76+
}
77+
7378
}
7479

7580
}

0 commit comments

Comments
 (0)