1、获得 Client 的相关信息
package com.shine.sun.small; import java.net.InetAddress; @Slf4j public class netInfo{ public static void main(String args[]){ InetAddress addr = InetAddress.getLocalHost(); String ip = addr.getHostAddress().toString(); // 172.16.11.160 String hostName = addr.getHostName().toString(); //small-sunshine log.info("===========本地的ip为:hostName【{}】=======================>", ip); log.info("===========本地的hostName为:hostName【{}】=================>", hostName); } }