解决某些特殊情况下获取网卡信息失败导致启动失败的问题

This commit is contained in:
heavyrian2012
2023-11-15 10:21:57 +08:00
parent df67b8e0c8
commit 327b8d43a8
@@ -357,7 +357,11 @@ public class Server {
private String getServerIp(IConfig config) {
String serverIp = config.getProperty(BrokerConstants.SERVER_IP_PROPERTY_NAME);
if (serverIp == null || serverIp.equals("0.0.0.0")) {
if(Utility.getLocalAddress() != null) {
serverIp = Utility.getLocalAddress().getHostAddress();
} else {
serverIp = "0.0.0.0";
}
}
return serverIp;
}