Merge remote-tracking branch 'origin/main'
# Conflicts: # agent/src/main/java/io/wdd/agent/initial/bootup/reference/collectSystemInfo.java
This commit is contained in:
2
.github/workflows/build-push-docker.yml
vendored
2
.github/workflows/build-push-docker.yml
vendored
@@ -101,7 +101,7 @@ jobs:
|
||||
with:
|
||||
context: ./
|
||||
# Path to the Dockerfile
|
||||
file: ./localEnvironment/src/main/java/io/wdd/localenviroment/build-my-own-base-image.dockerfile
|
||||
file: ./source/src/main/java/io/wdd/source/build-my-own-base-image.dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.docker_tags_base.outputs.tags }}
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
package io.wdd.agent.initial.bootup.reference;
|
||||
package io.wdd.agent.initial.bootup;
|
||||
|
||||
|
||||
|
||||
import io.wdd.agent.initial.beans.ServerInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class collectSystemInfo implements ApplicationContextAware {
|
||||
public class collectSystemInfo {
|
||||
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
Environment environment;
|
||||
|
||||
private ApplicationContext context;
|
||||
|
||||
@Bean
|
||||
public void initialReadingEnvironment(){
|
||||
@@ -39,25 +33,16 @@ public class collectSystemInfo implements ApplicationContextAware {
|
||||
Properties props =System.getProperties();
|
||||
|
||||
System.out.println("props = " + props);
|
||||
System.out.println();
|
||||
|
||||
Map<String, String> getenv = System.getenv();
|
||||
|
||||
System.out.println("getenv = " + getenv);
|
||||
|
||||
System.out.println();
|
||||
|
||||
System.out.println("environment = " + environment);
|
||||
|
||||
InetAddress loopbackAddress = InetAddress.getLoopbackAddress();
|
||||
|
||||
System.out.println("loopbackAddress = " + loopbackAddress);
|
||||
|
||||
InetAddress ip = InetAddress.getLocalHost();
|
||||
String localName = ip.getHostName();
|
||||
|
||||
|
||||
System.out.println("ip = " + ip);
|
||||
|
||||
|
||||
System.out.println("environment = " + environment);
|
||||
|
||||
String localName = ip.getHostName();
|
||||
String osName = System.getProperty("os.name");
|
||||
String userName = System.getProperty("user.name");
|
||||
String osVersion = System.getProperty("os.version");
|
||||
@@ -70,27 +55,10 @@ public class collectSystemInfo implements ApplicationContextAware {
|
||||
System.out.println("主机系统:" + osName);
|
||||
System.out.println("系统版本:" + osVersion);
|
||||
System.out.println("系统架构:" + osArch);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void getInjectServerInfo(){
|
||||
|
||||
log.info("getInjectServerInfo");
|
||||
|
||||
ServerInfo serverInfo = (ServerInfo) context.getBean("serverInfo");
|
||||
|
||||
|
||||
System.out.println("serverInfo = " + serverInfo);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.context = applicationContext;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user