当前位置:Gxlcms > 数据库问题 > 使用Dropwizard(2)-配置分类ConfiguredBundle

使用Dropwizard(2)-配置分类ConfiguredBundle

时间:2021-07-01 10:21:17 帮助过:22人阅读

class ConnectivityBundle implements ConfiguredBundle<HelloWorldConfiguration> { @Override public void run(HelloWorldConfiguration configuration, Environment environment) throws Exception { //init hystrix config Map<String, Object> hystrixConfig = configuration.getHystrixConfig(); for (final Map.Entry<String, Object> config : hystrixConfig.entrySet()) { ConfigurationManager.getConfigInstance().setProperty(config.getKey(), config.getValue()); System.out.println(config.getKey()); } } @Override public void initialize(Bootstrap<?> bootstrap) { } }

然后,在Application中添加就好了。
com.test.HelloWorldApplication

@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
    bootstrap.addBundle(new ConnectivityBundle());
}

使用Dropwizard(2)-配置分类ConfiguredBundle

标签:int   htm   使用   err   red   markdown   技术   exce   app   

人气教程排行