package com.jg;

import lombok.extern.slf4j.Slf4j;
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 java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 启动程序
 * 
 * @author jg
 */
@Slf4j
@EnableScheduling
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class JGApplication
{
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(JGApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        System.out.println("----------------------------------------------------------");
        System.out.println("  ████████   ██                      ██  \n" +
                " ██░░░░░░   ░██                     ░██  \n" +
                "░██        ██████  ██████   ██████ ██████\n" +
                "░█████████░░░██░  ░░░░░░██ ░░██░░█░░░██░ \n" +
                "░░░░░░░░██  ░██    ███████  ░██ ░   ░██  \n" +
                "       ░██  ░██   ██░░░░██  ░██     ░██  \n" +
                " ████████   ░░██ ░░████████░███     ░░██ ");
        System.out.println("----------------------------------------------------------");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application is running! Access URLS:\n\t" +
                "localhost: \t\t\thttp://" + "localhost" + ":" + port + "/\n\t" +
                "localhostDoc: \t\thttp://" + "localhost" + ":" + port + "/doc.html\n\t" +
                "Doc: \t\t\t\thttp://" + ip + ":" + port + "/doc.html\n\t" +
                "swagger-ui: \t\thttp://" + ip + ":" + port + "/swagger-ui/index.html\n\t" +
                "----------------------------------------------------------");
    }

}
