package com.seer.teach.teacher.bootstrap;

import cn.hutool.core.net.NetUtil;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * @author Captain
 */
@SpringBootApplication(scanBasePackages = {"com.seer.teach"})
@EnableFeignClients("com.seer.teach")
@MapperScan(value = {"com.seer.teach.**.mapper"})
@EnableScheduling
@EnableDiscoveryClient
@EnableAsync
@Slf4j
public class SeerTeacherApplicationBootStrap {
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(SeerTeacherApplicationBootStrap.class);
        Environment env = app.run(args).getEnvironment();
        String port = env.getProperty("server.port", "8087");
        String contextPath = env.getProperty("server.servlet.context-path", "/");
        log.info("----------------------------------------------------------");
        log.info("---------Application '{}' is running-------------------",env.getProperty("spring.application.name"));
        log.info("-----------Local : http://localhost:{}{} --------------",port,contextPath);
        log.info("--------------Ip : http://{}:{}{}  --------------------", NetUtil.getLocalhostStr(),port,contextPath);
        log.info("---------Swagger : http://{}:{}{}/swagger-ui/index.html",NetUtil.getLocalhostStr(),port,contextPath);
        log.info("----------------------------------------------------------");

    }
}