package com.gyee.alarm;

import lombok.extern.log4j.Log4j2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;

@Log4j2
@SpringBootApplication
@MapperScan("com.gyee.alarm.mapper")
public class AlarmWeb {
    public static void main(String[] args) throws Exception {
        ConfigurableApplicationContext application = SpringApplication.run(AlarmWeb.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");


        log.info("\n-------------------------------------------------------------------\n\t" +
                "智能报警系统启动成功，访问路径如下:\n\t" +
                "本地路径: \t\thttp://localhost:" + port + path + "\n\t" +
                "网络地址: \t\thttp://" + ip + ":" + port + path + "\n\t" +
                "API文档: \t\thttp://" + ip + ":" + port + path + "/swagger-ui.html\n" +
                "-----------------------------------------------------------------------");
    }
}
