What purpose CheckCommand of Dropwizard have?

I read CheckCommand’s source: https://github.com/dropwizard/dropwizard/blob/master/dropwizard-core/src/main/java/io/dropwizard/cli/CheckCommand.java

It does not seem to be doing anything.

And I debugged it but the following methods were not called.

@Override
protected Class<T> getConfigurationClass() {
    return configurationClass;
}
@Override
protected void run(Bootstrap<T> bootstrap,
                   Namespace namespace,
                   T configuration) throws Exception {
    LOGGER.info("Configuration is OK");
}

1.What timing are they called?
2.Why does the class exist?

Answer

The check command is executed if you call your dropwizard application with the check commandline parameter.

As the comment above the class says, it parses and validates the given configuration file.

Assuming your application is called foo.jar, the following commandline checks the configuration file config.yaml:

java -jar foo.jar check config.yaml

Leave a Reply

Your email address will not be published. Required fields are marked *