I think that BindableRuntimeHintsRegistrarTests could be improved by making the tests more rigorous. For example, when checking metadata for Java bean binding the method hints are checked to assert that their names start with set, get, or is but we don't check that the hints generated match what is expected based on the class's methods. At the moment, all the test pass when the code is changed such that no getter and setter hints are registered:
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java
index 3734469d1f..e8e8d65ed1 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrar.java
@@ -204,7 +204,7 @@ public class BindableRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
for (PropertyDescriptor propertyDescriptor : this.propertyDescriptors) {
Method writeMethod = propertyDescriptor.getWriteMethod();
if (writeMethod != null) {
- hints.registerMethod(writeMethod, ExecutableMode.INVOKE);
+ // hints.registerMethod(writeMethod, ExecutableMode.INVOKE);
}
Method readMethod = propertyDescriptor.getReadMethod();
if (readMethod != null) {
@@ -214,7 +214,7 @@ public class BindableRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
continue;
}
handleProperty(hints, propertyName, propertyType);
- hints.registerMethod(readMethod, ExecutableMode.INVOKE);
+ // hints.registerMethod(readMethod, ExecutableMode.INVOKE);
}
}
}