Код: Выделить всё
@Component
public class NettyConfiguration implements WebServerFactoryCustomizer {
@Override
public void customize(NettyReactiveWebServerFactory factory) {
factory.addServerCustomizers(new NettyCustomizer());
}
}
Код: Выделить всё
public class NettyCustomizer implements NettyServerCustomizer {
private final EventLoopGroup bossGroup = new NioEventLoopGroup(22);
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
@Override
public HttpServer apply(HttpServer httpServer) {
return httpServer.tcpConfiguration(tcpServer ->
tcpServer.bootstrap(serverBootstrap ->
serverBootstrap
.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.handler(new LoggingHandler(LogLevel.DEBUG))
.childHandler(new ChannelInitializer() {
@Override
public void initChannel(final SocketChannel socketChannel) {
socketChannel.pipeline().addLast(new BufferingInboundHandler());
}
})
.option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.SO_KEEPALIVE, true))
.port(8899)
);
}
}
Код: Выделить всё
org.springframework.boot.web.server.WebServerException: Unable to start Netty
Caused by: java.lang.IllegalStateException: group set already
Подробнее здесь: https://stackoverflow.com/questions/539 ... -1-webflux
Мобильная версия