Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.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 Spring 5 WebClient |禁止连接拒绝异常日志记录_Java_Spring_Spring Webflux - Fatal编程技术网

Java Spring 5 WebClient |禁止连接拒绝异常日志记录

Java Spring 5 WebClient |禁止连接拒绝异常日志记录,java,spring,spring-webflux,Java,Spring,Spring Webflux,如何在以下客户端http调用中抑制日志记录连接被拒绝的异常 return WebClient.create("http://anyurl") .get() .uri(builder -> { return builder.path("/somePath") .queryParam("...", ...) .build(); }) .retrieve() .bodyToFl

如何在以下客户端http调用中抑制日志记录连接被拒绝的异常

return WebClient.create("http://anyurl")
    .get()
    .uri(builder -> {
        return builder.path("/somePath")
                .queryParam("...", ...)
                .build();
    })
    .retrieve()
    .bodyToFlux(AnyPojo.class)
    // shouldn't this convert any error in an empty Flux?
    .onErrorResume(e -> Flux.empty())
    .map(this::myMappingMethod)
    .collectList()
    .block();
我已经在链中应用了
onerrorsume()
,但仍然记录了错误:

07:31:51.997 [reactor-http-nio-5] ERROR o.s.web.reactive.function.client - onError(io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: 068933adf361/172.17.0.2:80)
07:31:51.998 [reactor-http-nio-5] ERROR o.s.web.reactive.function.client -
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: 068933adf361/172.17.0.2:80
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:352)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:612)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:559)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:476)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused
    ... 10 common frames omitted

它确实将错误转换为一个空通量,但看起来它也在记录它。我不能确定,但它看起来像是在记录错误严重性;如果是这样的话,您可能应该提交一个bug,因为这肯定没有那么严重。我按照您的建议提交了一个bug: