12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package com.usky.gateway;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- import org.springframework.cloud.openfeign.EnableFeignClients;
- import org.springframework.context.ConfigurableApplicationContext;
- import org.springframework.context.annotation.ComponentScan;
- import org.springframework.core.env.Environment;
- import java.net.InetAddress;
- import java.net.UnknownHostException;
- /**
- * 应用启动模块
- *
- */
- @EnableFeignClients(basePackages = "com.usky")
- @ComponentScan("com.usky")
- @SpringBootApplication
- public class ApplicationRun
- {
- private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationRun.class);
- public static void main(String[] args) throws UnknownHostException {
- ConfigurableApplicationContext application = SpringApplication.run(ApplicationRun.class, args);
- Environment env = application.getEnvironment();
- String ip = InetAddress.getLocalHost().getHostAddress();
- String port = env.getProperty("server.port");
- String path = env.getProperty("server.servlet.context-path");
- LOGGER.info("\n----------------------------------------------------------\n\t" +
- "Application is running! Access URLs:\n\t" +
- "Local: \t\thttp://localhost:" + port + (null==path?"":path) + "/\n\t" +
- "External: \thttp://" + ip + ":" + port + (null==path?"":path) + "/\n\t" +
- "Api: \t\thttp://" + ip + ":" + port + (null==path?"":path) + "/swagger-ui/index.html\n\t" +
- "----------------------------------------------------------");
- }
- }
|