| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package com.zd.gateway;
- import com.zd.common.core.launch.ZdStartApplication;
- import com.zd.model.constant.ApplicationConstants;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
- 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;
- /**
- * 网关启动程序
- *
- * @author zd
- */
- @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
- @ComponentScan(basePackages ={"com.zd.common.core.redis","com.zd.gateway"} )
- public class ZdGatewayApplication {
- static Logger logger = LoggerFactory.getLogger(ZdGatewayApplication.class);
- public static void main(String[] args) {
- ConfigurableApplicationContext run = ZdStartApplication.run(ApplicationConstants.GATEWAY_SERVICE, ZdGatewayApplication.class, args);
- Environment env = run.getEnvironment();
- try {
- logger.info("\n----------------------------------------------------------\n\t" +
- "Application '{}' is running! Access URLs:\n\t" +
- "Local: \t\thttp://localhost:{}\n\t" +
- "External: \thttp://{}:{}\n\t" +
- "文档地址: \thttp://{}:{}/doc.html\n\t" +
- "----------------------------------------------------------",
- env.getProperty("spring.application.name"),
- env.getProperty("server.port"),
- InetAddress.getLocalHost().getHostAddress(),
- env.getProperty("server.port"),
- InetAddress.getLocalHost().getHostAddress(),
- env.getProperty("server.port")
- );
- } catch (UnknownHostException e) {
- e.printStackTrace();
- }
- }
- }
|