Spring Webflux自定义Netty参数解析

自定义 webflux 容器配置
配置代码
@Component
public class ContainerConfig extends ReactiveWebServerFactoryCustomizer {
    public ContainerConfig(ServerProperties serverProperties) {
        super(serverProperties);
    }

    @Override
    public void customize(ConfigurableReactiveWebServerFactory factory) {
        super.customize(factory);
        NettyReactiveWebServerFactory nettyFactory = (NettyReactiveWebServerFactory) factory;
        nettyFactory.setResourceFactory(null);
        nettyFactory.addServerCustomizers(server ->
                server.tcpConfiguration(tcpServer ->
                        tcpServer.runOn(LoopResources.create("mfilesvc", Runtime.getRuntime().availableProcessors() * 4, Runtime.getRuntime().availableProcessors() * 8, true))
                                .selectorOption(CONNECT_TIMEOUT_MILLIS, 200)

                ).channelGroup(new ChannelGroup())
        );
收藏 (0)
评论列表
正在载入评论列表...
我是有底线的
为您推荐
    暂时没有数据