| | |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | |
| | | /** |
| | | * @author mitao |
| | |
| | | @EnableCustomSwagger2 |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | public class XinQuanUserApplication { |
| | | |
| | | public static void main(String[] args) throws UnknownHostException { |
| | | SpringApplication app = new SpringApplicationBuilder(XinQuanUserApplication.class).build(args); |
| | | Environment env = app.run(args).getEnvironment(); |
| | | String protocol = "http"; |
| | | if (env.getProperty("server.ssl.key-store") != null) { |
| | | protocol = "https"; |
| | | try{ |
| | | SpringApplication app = new SpringApplicationBuilder(XinQuanUserApplication.class).build(args); |
| | | Environment env = app.run(args).getEnvironment(); |
| | | String protocol = "http"; |
| | | if (env.getProperty("server.ssl.key-store") != null) { |
| | | protocol = "https"; |
| | | } |
| | | log.info("--/\n---------------------------------------------------------------------------------------\n\t" + |
| | | "Application '{}' is running! Access URLs:\n\t" + |
| | | "Local: \t\t{}://localhost:{}\n\t" + |
| | | "External: \t{}://{}:{}\n\t" + |
| | | "Profile(s): \t{}" + |
| | | "\n---------------------------------------------------------------------------------------", |
| | | env.getProperty("spring.application.name"), |
| | | protocol, |
| | | env.getProperty("server.port"), |
| | | protocol, |
| | | InetAddress.getLocalHost().getHostAddress(), |
| | | env.getProperty("server.port"), |
| | | env.getActiveProfiles()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.err.println(e); |
| | | } |
| | | log.info("--/\n---------------------------------------------------------------------------------------\n\t" + |
| | | "Application '{}' is running! Access URLs:\n\t" + |
| | | "Local: \t\t{}://localhost:{}\n\t" + |
| | | "External: \t{}://{}:{}\n\t" + |
| | | "Profile(s): \t{}" + |
| | | "\n---------------------------------------------------------------------------------------", |
| | | env.getProperty("spring.application.name"), |
| | | protocol, |
| | | env.getProperty("server.port"), |
| | | protocol, |
| | | InetAddress.getLocalHost().getHostAddress(), |
| | | env.getProperty("server.port"), |
| | | env.getActiveProfiles()); |
| | | |
| | | |
| | | } |
| | | } |