可在@igor Artamonov &的帮助下,从
这里的解决办法是:
1. 建立NioEventLoop 海关检察官小组(没有校对、姓名、封顶盖)
{
Integer THREADS = 10;
Executor EXECUTOR = new ThreadPoolExecutor(THREADS, THREADS, 0L, TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<Runnable>(10), new CustomizableThreadFactory("ThreadNamePrefix-"));
NioEventLoopGroup RESOURCE = new NioEventLoopGroup(THREADS, EXECUTOR);
}
2. 创建特许工厂
public ReactorResourceFactory getReactorResourceFactory() {
ReactorResourceFactory rf = new ReactorResourceFactory();
rf.setLoopResources(new LoopResources() {
@Override
public EventLoopGroup onServer(boolean b) {
return RESOURCE;
}
});
rf.setConnectionProvider(ConnectionProvider.create("Custom-WebClient-Name"));
return rf;
}
3) 建立ReactorHttpConnector(与SSL环境相结合,允许不安全的地点)
private ClientHttpConnector getCustomReactorHttpConnector() {
try {
SslContext sslContext = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE)
.build();
return new ReactorClientHttpConnector(getReactorResourceFactory(),
httpClient -> httpClient.secure(sslContextSpec -> sslContextSpec.sslContext(sslContext)));
} catch (Exception e) {
}
}
4: 建立网络联系(旨在确定最高层的习俗交流战略)
WebClient wc = WebClient.builder().clientConnector(getCustomReactorHttpConnector())
.baseUrl(endpoint.getHost() + endpoint.getUrl()).exchangeStrategies(getExchangeStrategies()).build();
5: 呼唤有色体的
Map<String,Object> resMap= wc.post().body(Mono.just(bodyStr), String.class).retrieve().bodyToMono(new ParameterizedTypeReference<Map<String, Object>>() {}).share().block();