From 619b2da733ecb533b5c631786a54d6d2673b8a8d Mon Sep 17 00:00:00 2001 From: pizihao <2335715300@qq.com> Date: Sat, 29 Apr 2023 21:39:25 +0800 Subject: [PATCH] fix : Modify the thread pool information passed to the server to ensure that the server can access the Netty server rather than the web server#(1187) #(812) --- .../src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java | 2 +- .../springboot/starter/config/NettyServerConfiguration.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java index 00a67f26..bb36b712 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java @@ -72,7 +72,7 @@ public class IdentifyUtil { port = customerNetwork[1]; } else { ip = inetUtil.findFirstNonLoopBackHostInfo().getIpAddress(); - port = environment.getProperty("server.port", "8080"); + port = environment.getProperty("spring.dynamic.thread-pool.local-server-port", "16691"); } String identify = ip + ":" diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/NettyServerConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/NettyServerConfiguration.java index d66ee807..21365293 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/NettyServerConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/NettyServerConfiguration.java @@ -26,12 +26,14 @@ import cn.hippo4j.rpc.handler.NettyServerTakeHandler; import cn.hippo4j.rpc.server.NettyServerConnection; import cn.hippo4j.rpc.server.Server; import cn.hippo4j.rpc.support.NettyServerSupport; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.context.EnvironmentAware; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +@Slf4j @Component public class NettyServerConfiguration implements ApplicationRunner, EnvironmentAware { @@ -51,6 +53,9 @@ public class NettyServerConfiguration implements ApplicationRunner, EnvironmentA try ( NettyServerConnection connection = new NettyServerConnection(handler); Server server = new NettyServerSupport(serverPort, connection, classes)) { + if (log.isInfoEnabled()) { + log.info("Netty server started, binding to port {}", serverPort.getPort()); + } server.bind(); } }