package com.seer.teach.mp.app;

import cn.hutool.core.net.NetUtil;
import com.seer.teach.common.config.feign.FeignConfig;
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.EnableScheduling;

@Slf4j
@EnableFeignClients(basePackages = "com.seer.teach.*.api",defaultConfiguration = FeignConfig.class)
@MapperScan(value={"com.seer.teach.user.mapper","com.seer.teach.**.mapper"})
@EnableDiscoveryClient
@SpringBootApplication(scanBasePackages = {"com.seer.teach"})
@EnableScheduling
public class SeerMpAppApplication {
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(SeerMpAppApplication.class);
        Environment env = app.run(args).getEnvironment();
        String port = env.getProperty("server.port", "8080");
        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("----------------------------------------------------------");
    }
}