package com.zksy;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 启动程序
 *
 * @author zksy
 */
@EnableScheduling
@EnableTransactionManagement
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class zksyApplication {
    private static Logger log = LoggerFactory.getLogger(zksyApplication.class);
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(zksyApplication.class, args);
        Environment environment = applicationContext.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = environment.getProperty("server.port");
        String path = environment.getProperty("server.context-path");
        path = path == null ? "" : path;
        /*log.info("\n--------------------------------------------------------------\n\t" +
                "Application DhccBootApplication is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + path + "/\n\t" +
                "External: \thttp://" + ip + ":" + port + path + "/\n\t" +
                "swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
                "code-create: \thttp://" + ip + ":" + port + path + "/gencode.html\n\t" +
                "doc.html: \thttp://" + ip + ":" + port + path + "/doc.html\n\t" +
                "--------------------------------------------------------------");*/
        // System.setProperty("spring.devtools.restart.enabled", "false");
        System.out.println("=============系统启动成功================\n");
    }
}
