Spring5 WebClient忽略https证书认证

阅读更多

 

public static WebClient createWebClient()  {
    SslContext sslContext = null;
    try {
        sslContext = SslContextBuilder
                .forClient()
                .trustManager(InsecureTrustManagerFactory.INSTANCE)
                .build();
} catch (SSLException e) {
        e.printStackTrace();
}

    SslContext finalSslContext = sslContext;
ClientHttpConnector httpConnector = new ReactorClientHttpConnector(opt -> {
        opt.sslContext(finalSslContext);
});
    return WebClient.builder().clientConnector(httpConnector).build();
}

你可能感兴趣的:(Spring5,WebClient,https,忽略证书,绕开证书)