Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用https将spring配置服务器与vertx一起使用?_Java_Vert.x - Fatal编程技术网

Java 如何使用https将spring配置服务器与vertx一起使用?

Java 如何使用https将spring配置服务器与vertx一起使用?,java,vert.x,Java,Vert.x,我有一个vert.x应用程序,它使用SpringConfigServer获取值。当config server位于http上时,代码完全正常工作,但当spring config server移动到https时,代码不工作 Vertx vertx = Vertx.vertx(); List<ConfigStoreOptions> configStores = new ArrayList<>(); List<String> configUrls = CoreConf

我有一个vert.x应用程序,它使用SpringConfigServer获取值。当config server位于http上时,代码完全正常工作,但当spring config server移动到https时,代码不工作

Vertx vertx = Vertx.vertx();
List<ConfigStoreOptions> configStores = new ArrayList<>();
List<String> configUrls = CoreConfigBean.getUrls(environment);
configUrls.forEach(url -> {
    configStores.add(new ConfigStoreOptions().setType("spring-config-server")
            .setConfig(new JsonObject().put("url", url).put("timeout",
                    Long.parseLong(ConfigurationUtil.CONFIG_SERVER_TIME_OUT))));
});
ConfigRetrieverOptions configRetrieverOptions = new ConfigRetrieverOptions();
configStores.forEach(configRetrieverOptions::addStore);
ConfigRetriever retriever = ConfigRetriever.create(vertx, configRetrieverOptions.setScanPeriod(0));
CompletableFuture<JsonObject> configLoader = new CompletableFuture<JsonObject>();
retriever.getConfig(json -> {
    if (json.succeeded()) {
        JsonObject jsonObject = json.result();
        if (jsonObject != null) {
            jsonObject.iterator().forEachRemaining(sourceValue -> System.setProperty(sourceValue.getKey(),
                    sourceValue.getValue().toString()));
        }
        configLoader.complete(json.result());
        json.mapEmpty();
        retriever.close();
        vertx.close();
    } else {
        json.otherwiseEmpty();
        retriever.close();
        vertx.close();
    }
});
configLoader.get();
Vertx Vertx=Vertx.Vertx();
List configStores=new ArrayList();
List configUrls=CoreConfigBean.getUrls(环境);
configURL.forEach(url->{
添加(新的ConfigStoreOptions().setType(“spring配置服务器”)
.setConfig(新的JsonObject().put(“url”,url).put(“超时”,
Long.parseLong(ConfigurationUtil.CONFIG_SERVER_TIME_OUT));
});
ConfigRetrieverOptions ConfigRetrieverOptions=新的ConfigRetrieverOptions();
forEach(configRetrieverOptions::addStore);
ConfigRetriever retriever=ConfigRetriever.create(vertx,configRetrieverOptions.setScanPeriod(0));
CompletableFuture configLoader=新的CompletableFuture();
retriever.getConfig(json->{
if(json.succeed()){
JsonObject JsonObject=json.result();
if(jsonObject!=null){
jsonObject.iterator().ForEachLeving(sourceValue->System.setProperty(sourceValue.getKey()),
sourceValue.getValue().toString());
}
configLoader.complete(json.result());
json.mapepty();
retriever.close();
vertx.close();
}否则{
json.otherwisempty();
retriever.close();
vertx.close();
}
});
configLoader.get();

通过在配置中提供
httpClientConfiguration
元素,尝试指定
HttpClientOptions

。。。
.setConfig(新的JsonObject()
.put(“url”,url)
.put(“超时”,Long.parseLong(ConfigurationUtil.CONFIG\u SERVER\u TIME\u OUT))
.put(“httpClientConfiguration”,新的JsonObject()
.put(“trustAll”,true)
.put(“ssl”,true));
...