Have BindingValidator validate inherited methods
agearhart opened this issue · comments
During the binding validation methods of extended interfaces are not validated and so only fail on use later during runtime.
For example:
public interface MasterConfig extends TelemetryConfig {
Integer maxDatabaseConnections();
}
public interface TelemetryConfig {
String telemetryUrl();
}
...
ReloadStrategy reloadStrategy = new PeriodicalReloadStrategy(1, TimeUnit.MINUTES);
ConfigFilesProvider files = () -> Arrays.asList(Paths.get("/etc/company/application/config.yml"));
ConfigurationSource source = new FilesConfigurationSource(files);
ConfigurationProvider configProvider = new ConfigurationProviderBuilder().withConfigurationSource(source)
.withReloadStrategy(reloadStrategy).build();
MasterConfig config = configProvider.bind("MasterConfig", MasterConfig.class);
Upon binding only maxDatabaseConnections is validated by BindingValidator. Should telemetryUrl not be supplied in the config the application only fails when the method is referenced.