如何在Dropwizard中注册/添加命令
我正在尝试使用dropwizard的功能
I am trying to use the functionality of dropwizard
http://dropwizard.codahale.com/manual/core/#commands
我写了一个从ConfiguredCommand和我想将其添加/注册到dropwizard服务/环境。我找不到如何从dropwizard添加/运行新命令。
I have written a class which extends from ConfiguredCommand and i want to add/register this to the dropwizard service/environment. I can't find out how to add/run the new command from dropwizard.
com。 yammer.dropwizard.config.Bootstrap
包含用于添加 ConfiguredCommand
的addCommand方法。当您在服务类中重写initialize方法时,将可以访问此对象,例如。
com.yammer.dropwizard.config.Bootstrap
contains an addCommand method for adding ConfiguredCommand
. You will get access to this object when you override initialize method in your service class, eg.
public void initialize (Bootstrap<T> configurationBootstrap) {
configurationBootstrap.addCommand(yourCommand);
}