How to register/add a command in dropwizard

a 夏天 提交于 2020-01-05 02:51:06

问题


I am trying to use the functionality of dropwizard

http://dropwizard.codahale.com/manual/core/#commands

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.


回答1:


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);
}


来源:https://stackoverflow.com/questions/22106508/how-to-register-add-a-command-in-dropwizard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!