All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dc.invoke.util.IpAddressUtil Maven / Gradle / Ivy

There is a newer version: 0.5.4
Show newest version
package com.github.dc.invoke.util;

import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;

import java.net.InetAddress;

/**
 * 

*

* * @author wangpeiyuan * @date 2022/6/8 10:35 */ @UtilityClass @Slf4j public class IpAddressUtil { public static InetAddress getLocalHost() { try { return InetAddress.getLocalHost(); } catch (Exception e) { log.warn("获取当前服务器ip异常"); } return null; } public static String getIp() { try { return getLocalHost().getHostAddress(); } catch (Exception e) { log.warn("获取当前服务器ip异常"); } return null; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy