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; } }