问题:
从spring config服务器的url中获取配置,并在Vertx应用程序的垂直版本中使用它。
我正在从vertx应用程序中的spring-config-server检索配置。 使用.getConfig-> json.result
时,我能够将配置作为JsonObject检索但是,当我通过设置config来部署verticle时,如何在我的所有ververt中获取此configRetriver对象。
Vertx vertx = Vertx.vertx();
ConfigRetriever configRetriever = ConfigRetriever.create(vertx,new ConfigRetrieverOptions()
.setScanPeriod(30000)
.addStore(new ConfigStoreOptions()
.setType("spring-config-server")
.setConfig(new JsonObject().put("url", "http://myurl"))));
.........Retrieving the configuraton.........
configRetriever.getConfig(json -> {
JsonObject result = json.result();}));
..........Deploying the Verticle...............
Stream.of(verticles).forEach(verticle -> newVertxInstance.deployVerticle(verticle,
new DeploymentOptions().setConfig(result.getJsonObject("source"))
..................