我有一个NettyServerCustomizer,它接下来的代码是:
@Override
public HttpServer apply(final HttpServer httpServer) {
return httpServer.tcpConfiguration(tcpServer -> tcpServer
.bootstrap(serverBootstrap -> serverBootstrap
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(final SocketChannel ch) throws Exception {
final ChannelPipeline p = ch.pipeline();
p.addFirst(new MyCustomChannelInboundHandlerAdapter());
}
})));
}但是reactor-netty已经通过PR:https://github.com/reactor/reactor-netty/pull/1175从0.9.10版本开始弃用了方法bootstrap。
如何使用新的API获得相同的行为?
发布于 2020-11-03 21:31:00
这已被弃用,因为在Reactor中,Netty 1.0.0、Bootstrap和ServerBootstrap已不再使用。https://github.com/reactor/reactor-netty/releases/tag/v1.0.0在0.9.x中没有对此特定用例的替代。在1.0.0中,替换为doOnChannelInit如果您的构建限制了不推荐使用的API,请打开一个功能请求,我们将尝试从1.0.0版本向后移植该API。
https://stackoverflow.com/questions/64662203
复制相似问题