Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have BindingValidator validate inherited methods #249

Open
agearhart opened this issue Mar 1, 2018 · 0 comments
Open

Have BindingValidator validate inherited methods #249

agearhart opened this issue Mar 1, 2018 · 0 comments

Comments

@agearhart
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant