This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
appsketch-works-device-api/src/main/java/net/geedge/EnvApiApplication.java

48 lines
1.6 KiB
Java
Raw Normal View History

2024-09-04 14:19:02 +08:00
package net.geedge;
import cn.hutool.extra.spring.EnableSpringUtil;
import net.geedge.api.entity.EnvApiYml;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import java.util.TimeZone;
@EnableSpringUtil
@SpringBootApplication
public class EnvApiApplication {
public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
SpringApplication.run(EnvApiApplication.class, args);
}
@Autowired
private Environment environment;
@Bean
public EnvApiYml envProperties() {
EnvApiYml apiYml = new EnvApiYml();
EnvApiYml.Env envEntity = apiYml.new Env();
envEntity.setRoot(environment.getProperty("env.root"));
envEntity.setType(environment.getProperty("env.type"));
envEntity.setPlatform(environment.getProperty("env.platform"));
EnvApiYml.Adb adb = apiYml.new Adb();
adb.setSerial(environment.getProperty("adb.serial"));
adb.setHost(environment.getProperty("adb.host"));
adb.setPort(environment.getProperty("adb.port", Integer.class));
EnvApiYml.Vnc vnc = apiYml.new Vnc();
vnc.setHost(environment.getProperty("vnc.host"));
vnc.setPort(environment.getProperty("vnc.port", Integer.class));
apiYml.setEnv(envEntity);
apiYml.setAdb(adb);
apiYml.setVnc(vnc);
return apiYml;
}
}