潘志宝
7 天以前 73b3a394952353c318a8712d2cc1efec03dc009d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//package com.iailab.module.system.job.config;
//
//import org.springframework.context.annotation.Configuration;
//
//import javax.annotation.PostConstruct;
//import java.net.InetAddress;
//import java.net.UnknownHostException;
//
///**
// * 服务器资源监控配置文件
// */
//@Configuration
//public class ServerInfoConfiguration {
//
//    public static String hostName;
//
//    public static String hostIp;
//
//    @PostConstruct
//    public void initServerInfo() throws UnknownHostException {
//        System.out.println("初始化获取服务器信息initServerInfo...");
//        // 获取本地主机对象
//        InetAddress localHost = InetAddress.getLocalHost();
//        // 获取主机名
//        hostName = localHost.getHostName();
//        // 获取IP地址
//        hostIp = localHost.getHostAddress();
//    }
//
//}